You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
846 B
37 lines
846 B
<?php
|
|
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class FileResource extends JsonResource
|
|
{
|
|
public function toArray($request)
|
|
{
|
|
$resource = [
|
|
'_service' => 'user',
|
|
'_resource' => 'files',
|
|
];
|
|
|
|
foreach ($this->getAttributes() as $attribute => $value) {
|
|
switch ($attribute) {
|
|
case 'user_id':
|
|
case 'business_id':
|
|
case 'project_id':
|
|
case 'disk':
|
|
case 'original_name':
|
|
case 'name':
|
|
case 'extension':
|
|
case 'mime':
|
|
case 'size':
|
|
case 'description':
|
|
$resource[$attribute] = $value;
|
|
break;
|
|
}
|
|
}
|
|
|
|
return $resource;
|
|
}
|
|
}
|