1/5/2022
This commit is contained in:
22
app/Http/Resources/ContactResource.php
Normal file
22
app/Http/Resources/ContactResource.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ContactResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'name' => $this->name,
|
||||
'href' => $this->href
|
||||
];
|
||||
}
|
||||
}
|
||||
28
app/Http/Resources/MomoResource.php
Normal file
28
app/Http/Resources/MomoResource.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class MomoResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'username' => $this->phone,
|
||||
'status' => $this->status,
|
||||
'settings' => array(
|
||||
'transfers_today' => array(
|
||||
'times' => $this->times,
|
||||
'amount' => $this->amount
|
||||
)
|
||||
)
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user