Laravel Eloquent pass variable to with relationship function
Use use
in the closure
->with(['assignment' => function ($query) use ($date){
You can try the following:
$user = User::with(array('relationShipMethod' => function($query) use ($request) {
$query->wherePivot('column', $request->column);
}))->first();
relationShipMethod = method with you relationship another table for example users has posts maybe relationShipMethod could be posts method