I'm passing in the user instance through route model binding, and I'm attempting to use the user in a query.
This is the function and the query.
public function text(User $user)
{
$messages = DB::table('messages')
->join('threads', function($join){
$join->on('messages.thread_id', '=', 'threads.id')
->where('threads.id', '=', $user->threads[0]->id);
})->get();
return view('backend.pending_registrations.textform', compact('user', 'messages'));
}
I'm getting this error
Undefined variable: user
Any ideas?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire