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
d54053ec
Unverified
Commit
d54053ec
authored
2 years ago
by
José Fernando Mendes da Costa
Committed by
GitHub
2 years ago
Browse files
Options
Download
Plain Diff
Merge pull request #814 from jofernando/inte+
checa se o mesmo integrante foi add mais de uma vez
parents
15cf9630
f99f8441
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/Http/Requests/StoreTrabalho.php
+14
-0
app/Http/Requests/StoreTrabalho.php
with
14 additions
and
0 deletions
+14
-0
app/Http/Requests/StoreTrabalho.php
View file @
d54053ec
...
@@ -6,6 +6,7 @@ use App\Evento;
...
@@ -6,6 +6,7 @@ use App\Evento;
use
Illuminate\Validation\Rule
;
use
Illuminate\Validation\Rule
;
use
Illuminate\Support\Facades\Auth
;
use
Illuminate\Support\Facades\Auth
;
use
Illuminate\Foundation\Http\FormRequest
;
use
Illuminate\Foundation\Http\FormRequest
;
use
Illuminate\Contracts\Validation\Validator
;
class
StoreTrabalho
extends
FormRequest
class
StoreTrabalho
extends
FormRequest
{
{
...
@@ -19,6 +20,17 @@ class StoreTrabalho extends FormRequest
...
@@ -19,6 +20,17 @@ class StoreTrabalho extends FormRequest
return
Auth
::
check
();
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.
* Get the validation rules that apply to the request.
*
*
...
@@ -30,6 +42,7 @@ class StoreTrabalho extends FormRequest
...
@@ -30,6 +42,7 @@ class StoreTrabalho extends FormRequest
$rules
=
[];
$rules
=
[];
if
(
$this
->
has
(
'marcado'
)){
if
(
$this
->
has
(
'marcado'
)){
$rules
[
'cpfs.*.cpf'
]
=
[
'distinct'
,
'nullable'
];
foreach
(
$this
->
get
(
'marcado'
)
as
$key
=>
$value
)
{
foreach
(
$this
->
get
(
'marcado'
)
as
$key
=>
$value
)
{
if
(
intval
(
$value
)
==
$key
){
if
(
intval
(
$value
)
==
$key
){
//user
//user
...
@@ -137,6 +150,7 @@ class StoreTrabalho extends FormRequest
...
@@ -137,6 +150,7 @@ class StoreTrabalho extends FormRequest
'anexoPlanoTrabalho.*.required'
=>
'O :attribute é obrigatório'
,
'anexoPlanoTrabalho.*.required'
=>
'O :attribute é obrigatório'
,
'anexoProjeto.required'
=>
'O :attribute é obrigatório'
,
'anexoProjeto.required'
=>
'O :attribute é obrigatório'
,
'cpf.*.required'
=>
'O cpf é 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'
,
'name.*.required'
=>
'O :attribute é obrigatório'
,
'email.*.required'
=>
'O :attribute é obrigatório'
,
'email.*.required'
=>
'O :attribute é obrigatório'
,
'instituicao.*.required'
=>
'O :attribute é obrigatório'
,
'instituicao.*.required'
=>
'O :attribute é obrigatório'
,
...
...
This diff is collapsed.
Click to expand it.
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