dimanche 4 février 2018

How to use leftJoin in Laravel for case?

I have the following code:

$registrations = User::where(function ($query) use ($request) {
   if (!is_null($request->region) && $request->region !== '0') {
      $query->where('region', $request->region);
   }
})->get();

How to join User result with another model Clients with Left Join condition?

I tried this way:

$registrations = User->join('clients', 'clients.id', '=', 'user.id')->where(...



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire