1
I need to get all users with "Exceção
" those of the function containing the id=2
, it is possible?
You can fit a Where
in that consultation?
I have the following consult at the bank Laravel
which returns an object to the datatables.net
follow-up consultation:
$query = User::query()->select('*');
$query->with(['roles']);
$table = Datatables::of($query);
This returns me all the users of the bank and with their respective functions 'roles'. if I want to fetch everyone from a certain function I do it:
$query = Role::find(1)->users;
$table = Datatables::of($query);
The '1' within find()
represents the id
of function
find(1)
but I need to get all users of all functions Except that of the id = 2
it is possible?
the functions of
Roles
???– novic
yes, the way it is in the example
– Rafael
Take a look at this query: $query = User::query()->select('*'); $query->with(['roles']); it returns to me all users of all Roles but I want it to return all users except those of role 1
– Rafael