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
9056abf8
Commit
9056abf8
authored
Aug 04, 2023
by
PedroLopesUPE
Browse files
Merge branch 'main' into dev-joao-pdf_generator
parents
a9fdd540
4e044949
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/UserController.php
View file @
9056abf8
...
@@ -89,7 +89,7 @@ class UserController extends Controller
...
@@ -89,7 +89,7 @@ class UserController extends Controller
public
function
actionStore
(
Request
$request
)
public
function
actionStore
(
Request
$request
)
{
{
$validator
=
User
::
validator
(
$request
->
all
());
$validator
=
User
::
validator
(
$request
->
all
()
,
null
,
true
,
[
'curso_id'
,
'campus_id'
]
);
if
(
$validator
->
fails
())
{
if
(
$validator
->
fails
())
{
return
redirect
()
->
route
(
'user_create'
)
->
withErrors
(
$validator
)
->
withInput
();
return
redirect
()
->
route
(
'user_create'
)
->
withErrors
(
$validator
)
->
withInput
();
...
@@ -138,7 +138,7 @@ class UserController extends Controller
...
@@ -138,7 +138,7 @@ class UserController extends Controller
{
{
$model
=
User
::
find
(
$id
);
$model
=
User
::
find
(
$id
);
$validator
=
User
::
validator
(
$request
->
all
(),
$model
->
id
);
$validator
=
User
::
validator
(
$request
->
all
(),
$model
->
id
,
true
,
[
'curso_id'
,
'campus_id'
]
);
if
(
$validator
->
fails
())
{
if
(
$validator
->
fails
())
{
return
redirect
()
->
route
(
'user_edit'
,
[
'id'
=>
$model
->
id
])
->
withErrors
(
$validator
)
->
withInput
();
return
redirect
()
->
route
(
'user_edit'
,
[
'id'
=>
$model
->
id
])
->
withErrors
(
$validator
)
->
withInput
();
...
...
app/Models/User.php
View file @
9056abf8
...
@@ -47,7 +47,7 @@ class User extends Authenticatable
...
@@ -47,7 +47,7 @@ class User extends Authenticatable
return
$this
->
status
!==
null
?
Status
::
listStatus
(
$this
->
status
)
:
'-'
;
return
$this
->
status
!==
null
?
Status
::
listStatus
(
$this
->
status
)
:
'-'
;
}
}
public
static
function
validator
(
array
$attributes
,
$id
=
null
,
$ignoreStatus
=
true
)
public
static
function
validator
(
array
$attributes
,
$id
=
null
,
$ignoreStatus
=
true
,
$ignoreAttributes
=
[]
)
{
{
$rules
=
[
$rules
=
[
'name'
=>
[
'required'
,
'min:4'
],
'name'
=>
[
'required'
,
'min:4'
],
...
@@ -65,6 +65,10 @@ class User extends Authenticatable
...
@@ -65,6 +65,10 @@ class User extends Authenticatable
],
],
];
];
foreach
(
$ignoreAttributes
as
$attribute
)
{
unset
(
$rules
[
$attribute
]);
}
$messages
=
[
$messages
=
[
//name
//name
'name.min'
=>
'O campo "Nome" dever ter no mínimo 4 caracteres.'
,
'name.min'
=>
'O campo "Nome" dever ter no mínimo 4 caracteres.'
,
...
...
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