I'm having pain with an ajax called method.
First the same request as above :
$usersData = User::where('name', 'like', $queryString . '%')
->orWhere('email', 'like', $queryString . '%')
->orWhere('username', 'like', $queryString . '%')
->when($limit > 0 || $offset > 0, function ($usersData) use ($limit, $offset) {
$usersData->take($limit)->skip($offset);
})
->with(array('roles'=>function($query){
$query->select('name');
}))
->get();
works perfectly in the index method, the dd is correct and 'roles' contain just the 'name' field BUT if i call exactly the same request 'roles' contain ALL attributes and dd does'nt work i'm forced to make a console.log of my datas I'm going mad !!!
Thanks for your help.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire