Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $usuarios = Usuario::with('nivel')->where(['status' => 1])->get()->toArray();
- // Resultado:
- [
- 'usuarios' => [
- 0 => [
- 'id' => 1,
- 'nome' => 'Wallace',
- 'nivel_id' => 4,
- 'nivel' => [
- 'id' => 4,
- 'nome' => 'Produção'
- ]
- ],
- 1 => [
- 'id' => 2,
- 'nome' => 'Wayne',
- 'nivel_id' => 5,
- 'nivel' => [
- 'id' => 5,
- 'nome' => 'Recepção'
- ]
- ]
- ]
- ];
Add Comment
Please, Sign In to add comment