codigo actual del servidor, con avances de joan
This commit is contained in:
32
app/Http/Resources/V2/BrandCollection.php
Normal file
32
app/Http/Resources/V2/BrandCollection.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\V2;
|
||||
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
class BrandCollection extends ResourceCollection
|
||||
{
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'data' => $this->collection->map(function($data) {
|
||||
return [
|
||||
'id' => $data->id,
|
||||
'name' => $data->getTranslation('name'),
|
||||
'logo' => uploaded_asset($data->logo),
|
||||
'links' => [
|
||||
'products' => route('api.products.brand', $data->id)
|
||||
]
|
||||
];
|
||||
})
|
||||
];
|
||||
}
|
||||
|
||||
public function with($request)
|
||||
{
|
||||
return [
|
||||
'success' => true,
|
||||
'status' => 200
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user