separate operator from supervisor in road item
This commit is contained in:
30
app/Services/Cartables/RoadItem/OperatorService.php
Normal file
30
app/Services/Cartables/RoadItem/OperatorService.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Cartables\RoadItem;
|
||||
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Models\RoadItemsProject;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class OperatorService
|
||||
{
|
||||
public function dataTable(Request $request, $loadRelations = false)
|
||||
{
|
||||
$query = RoadItemsProject::query()
|
||||
->where('is_new', '=', 1)
|
||||
->where('user_id', '=', auth()->user()->id)
|
||||
->when($loadRelations, fn ($query) => $query->with(['rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number']));
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
allowedSelects: [
|
||||
'id', 'province_fa', 'edarat_name', 'supervisor_description', 'item', 'item_fa',
|
||||
'sub_item', 'sub_item_fa', 'sub_item_data', 'unit_fa', 'start_lat', 'start_lng',
|
||||
'end_lat', 'end_lng', 'activity_date_time', 'created_at', 'status_fa', 'status'
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user