jeudi 3 août 2017

Where cluse in With() laravel doesn't work

Hello I have a little problem with eloquent in Laravel 5.

I have this function:

$lists = Model::with(array('relation_with_registered_in_model'=>function($query){
                $query->where("name","cccc");
          }))->get();

My poblem is that return always all results, ignoring where clause.

I tried to print my query (generated with function) and if I execute the query in my phpmyadmin it return correct filtered results.

What I'm wrong?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire