Added public search API
Finally moved over the public search API from the old version and updated the about page to show the new data structure Also tweaked the location update script to change 'defederate' to 'suspend' for the sake of consistencydevelop
parent
d5efbd96a3
commit
0c2b8bae7c
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
class LocationCollection extends ResourceCollection
|
||||
{
|
||||
/**
|
||||
* Transform the resource collection into an array.
|
||||
*
|
||||
* @return array<int|string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
//return parent::toArray($request);
|
||||
|
||||
return [
|
||||
'listingCount' => count($this->collection),
|
||||
'locations' => LocationResource::collection($this->collection),
|
||||
];
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class LocationResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'url' => $this->url,
|
||||
'name' => $this->name,
|
||||
'description' => $this->description,
|
||||
'rating' => $this->rating,
|
||||
'count' => $this->block_count,
|
||||
'link' => "/location/" . $this->uuid,
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue