for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Http\Resources\DataTables;
use Illuminate\Http\Resources\Json\JsonResource;
/**
* @property \App\Models\Order $resource
*/
class OrderResource extends JsonResource
{
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
public function toArray($request)
return [
'checkbox' => view('components.datatables.checkbox', [
'id' => 'order_' . $this->resource->getKey(),
])->render(),
'code' => $this->resource->code,
'customer_fullname' => view('components.datatables.link', [
'url' => route('customer.edit', $this->resource->customer),
'name' => $this->resource->customer->fullname,
]),
'schedule_date' => $this->resource->schedule_date,
'status' => $this->resource->status,
'action' => view('components.datatables.link', [
'url' => route('order.edit', $this->resource),
'name' => __('Details'),
'class' => 'btn btn-primary',
];
}