How can I make this conditions with eloquent? I want all records with product
and category
table whose url_name
equals to $variable_name
.
Here is the code:
\App\Product::with(['category' => function ($query) {
$query->whereHas('url_name','Summer-Collection');
}])->get();