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.
32 lines
766 B
32 lines
766 B
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class TransactionResource extends JsonResource
|
|
{
|
|
public function toArray($request)
|
|
{
|
|
$resource = [
|
|
'_service' => 'user',
|
|
'_resource' => 'transactions',
|
|
];
|
|
|
|
foreach ($this->getAttributes() as $attribute => $value) {
|
|
switch ($attribute) {
|
|
case 'user_id':
|
|
case 'business_id':
|
|
case 'amount':
|
|
case 'succeeded':
|
|
case 'options':
|
|
case 'created_at':
|
|
case 'updated_at':
|
|
$resource[$attribute] = $value;
|
|
break;
|
|
}
|
|
}
|
|
|
|
return $resource;
|
|
}
|
|
}
|