Laravel 10 relation dynamic variable in subquery
How can I call a dynamic variable in a subquery? I have some relations and call them like: $locations = Location::query() ->with('brands', function ($query) { $query->with('employees')->where('location_id', {dynamic ID of brand location}); }) ->get(); The relation in the Location.php Class: public…