Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Walter Felipe
pad-upe
Commits
6ba8af32
Commit
6ba8af32
authored
Mar 11, 2022
by
alissonalbuquerque
Browse files
add atualizações no model de User'
parent
1759bc1b
Changes
1
Show whitespace changes
Inline
Side-by-side
app/Models/User.php
View file @
6ba8af32
...
@@ -12,9 +12,10 @@ class User extends Authenticatable
...
@@ -12,9 +12,10 @@ class User extends Authenticatable
{
{
use
HasApiTokens
,
HasFactory
,
Notifiable
;
use
HasApiTokens
,
HasFactory
,
Notifiable
;
const
TYPE_ADMIN
=
1
;
const
TYPE_ADMIN
=
1
;
// Administrador
const
TYPE_MENAGER
=
2
;
const
TYPE_TEACHER
=
2
;
// Professor
const
TYPE_TEACHER
=
3
;
const
TYPE_MANAGER
=
3
;
// Diretor
const
TYPE_COORDINATOR
=
4
;
// Coordenador
const
STATUS_ACTIVE
=
1
;
const
STATUS_ACTIVE
=
1
;
const
STATUS_INACTIVE
=
2
;
const
STATUS_INACTIVE
=
2
;
...
@@ -27,7 +28,7 @@ class User extends Authenticatable
...
@@ -27,7 +28,7 @@ class User extends Authenticatable
*
*
* @var array<int, string>
* @var array<int, string>
*/
*/
protected
$fillable
=
[
'name'
,
'email'
,
'password'
,
'document'
,
'type'
,
'status'
,
'
unidade_id'
,
'curso
_id'
];
protected
$fillable
=
[
'name'
,
'email'
,
'password'
,
'document'
,
'type'
,
'status'
,
'
curso_id'
,
'unidade
_id'
];
/**
/**
* The attributes that should be hidden for serialization.
* The attributes that should be hidden for serialization.
...
@@ -44,4 +45,33 @@ class User extends Authenticatable
...
@@ -44,4 +45,33 @@ class User extends Authenticatable
protected
$casts
=
[
protected
$casts
=
[
'email_verified_at'
=>
'datetime'
'email_verified_at'
=>
'datetime'
];
];
/**
* Get Curso with curso.id = user.curso_id
*
* @return Curso|null
*/
public
function
curso
()
{
return
$this
->
belongsTo
(
Curso
::
class
);
}
/**
* Get Unidade with unidade.id = user.unidade_id
*
* @return Unidade|null
*/
public
function
unidade
()
{
return
$this
->
belongsTo
(
Unidade
::
class
);
}
/**
* @return string
*/
public
function
__toString
()
{
return
$this
->
name
;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment