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
submeta
Commits
f99f8441
Commit
f99f8441
authored
May 11, 2023
by
José Fernando Mendes da Costa
Browse files
checa se o mesmo integrante foi add mais de uma vez
parent
15cf9630
Changes
1
Show whitespace changes
Inline
Side-by-side
app/Http/Requests/StoreTrabalho.php
View file @
f99f8441
...
...
@@ -6,6 +6,7 @@ use App\Evento;
use
Illuminate\Validation\Rule
;
use
Illuminate\Support\Facades\Auth
;
use
Illuminate\Foundation\Http\FormRequest
;
use
Illuminate\Contracts\Validation\Validator
;
class
StoreTrabalho
extends
FormRequest
{
...
...
@@ -19,6 +20,17 @@ class StoreTrabalho extends FormRequest
return
Auth
::
check
();
}
protected
function
prepareForValidation
()
{
$func
=
function
(
$value
)
{
return
[
'cpf'
=>
$value
];
};
$this
->
merge
([
'cpfs'
=>
array_map
(
$func
,
$this
->
cpf
),
]);
}
/**
* Get the validation rules that apply to the request.
*
...
...
@@ -30,6 +42,7 @@ class StoreTrabalho extends FormRequest
$rules
=
[];
if
(
$this
->
has
(
'marcado'
)){
$rules
[
'cpfs.*.cpf'
]
=
[
'distinct'
,
'nullable'
];
foreach
(
$this
->
get
(
'marcado'
)
as
$key
=>
$value
)
{
if
(
intval
(
$value
)
==
$key
){
//user
...
...
@@ -137,6 +150,7 @@ class StoreTrabalho extends FormRequest
'anexoPlanoTrabalho.*.required'
=>
'O :attribute é obrigatório'
,
'anexoProjeto.required'
=>
'O :attribute é obrigatório'
,
'cpf.*.required'
=>
'O cpf é obrigatório'
,
'cpfs.*.cpf.distinct'
=>
'O integrante com CPF :input não pode ser adicionado mais de uma vez'
,
'name.*.required'
=>
'O :attribute é obrigatório'
,
'email.*.required'
=>
'O :attribute é obrigatório'
,
'instituicao.*.required'
=>
'O :attribute é obrigatório'
,
...
...
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