vendredi 23 octobre 2020

Joining two models in Laravel Eloquent

I have a model stored in a variable like:

$user = User::where('name', 'like', $test)
             ->orderBy('name');

I would like to build another query where I can join $user. Can't find the right syntax to do it.

What am trying to achieve:

$numbers= Number::>join($user, $users.id, '=', 'number.user_id')
                        ->where('name', 'like', "%" . $validated['text'] . "%")])
                        ->get();


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire