Please tell me the solution if exists. This is my code:
public function handleRequest()
{
if (request()->filled('location_id')) {
$this->notification = $this->notification
->whereHas('location', function ($query)
{
$query->where('location_id',
request('location_id'));
});
}
return $this->notification;
}
I want to get the data of the "notification" table only, but this query returns "Location" table's data too. I have to use the $query scoped solution.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire