first commit
This commit is contained in:
26
app/Http/Resources/BankCollection.php
Normal file
26
app/Http/Resources/BankCollection.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
class BankCollection extends ResourceCollection
|
||||
{
|
||||
|
||||
/**
|
||||
* 将资源集合转换成数组。
|
||||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$array = [];
|
||||
foreach ($this->collection as $key => $bank) {
|
||||
$array[$key]['id'] = $bank->id;
|
||||
$array[$key]['title'] = $bank->title;
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user