dimanche 20 août 2017

Use variable of current Eloquent in with method - LARAVEL

So I have this code (which won't work):

$accessuser = AccessUser::where('user_id', Auth::user()->id)
              ->with(['overtimes' => function ($qry) use ($accessuser) {
                  $qry->where('waiting_for', $accessuser->access_level)->get();
              }])->get();

Obviously, I just want to get the value of access_level column and compare it to waiting_for column.

Is there any solution for this? Let me know if you need any additional information about my table structure, etc.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2fXmFij
via IFTTT

Aucun commentaire:

Enregistrer un commentaire