jeudi 25 avril 2019

I want to get data of first table only by writing eloquent $query scoped function

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.



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2XIXT5P
via IFTTT

Aucun commentaire:

Enregistrer un commentaire