lundi 28 janvier 2019

How to pass join query in laravel to view route

I have this route passing Notification model:

Route::view('masaya', 'pages.notifications-table', [
    'data' => App\Notification::all()
]);

How do i pass this query to instead of the model:

$inspect = DB::table('notifications')
    ->leftJoin('franchises', 'franchises.id', '=', 'notifications.franchise_id')
    ->leftJoin('units', 'units.id', '=', 'notifications.unit_id')
    ->select('franchises.id as fid', 'franchises.case_number', 'franchises.authorize_units', 'franchises.deno', 'franchises.route_name', 'franchises.expiry_date', 'franchises.date_granted', 'units.id as uid', 'units.plate_number', 'units.motor_number', 'units.chassis_number', 'units.make', 'notifications.id', 'notifications.remarks', 'notifications.created_at', 'notifications.plate_picture')
    ->orderBy('units.updated_at', 'desc')
    ->paginate(20);



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire