codigo actual del servidor, con avances de joan
This commit is contained in:
37
app/Http/Resources/V2/UserCollection.php
Normal file
37
app/Http/Resources/V2/UserCollection.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\V2;
|
||||
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
class UserCollection extends ResourceCollection
|
||||
{
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'data' => $this->collection->map(function($data) {
|
||||
return [
|
||||
'id' => (integer) $data->id,
|
||||
'name' => $data->name,
|
||||
'type' => $data->user_type,
|
||||
'email' => $data->email,
|
||||
'avatar' => $data->avatar,
|
||||
'avatar_original' => uploaded_asset($data->avatar_original),
|
||||
'address' => $data->address,
|
||||
'city' => $data->city,
|
||||
'country' => $data->country,
|
||||
'postal_code' => $data->postal_code,
|
||||
'phone' => $data->phone
|
||||
];
|
||||
})
|
||||
];
|
||||
}
|
||||
|
||||
public function with($request)
|
||||
{
|
||||
return [
|
||||
'success' => true,
|
||||
'status' => 200
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user