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
690fda6a
Unverified
Commit
690fda6a
authored
Jun 27, 2020
by
Gabriel Antônio da Silva
Committed by
GitHub
Jun 27, 2020
Browse files
Merge pull request #43 from lmts-ufape/fixbugs
validate xls e xlsx em criar edital
parents
33614eb8
57196f78
Changes
3
Show whitespace changes
Inline
Side-by-side
app/Http/Controllers/EventoController.php
View file @
690fda6a
...
...
@@ -18,6 +18,7 @@ use App\Natureza;
use
App\CoordenadorComissao
;
use
Illuminate\Http\Request
;
use
Carbon\Carbon
;
use
App\Rules\ExcelRule
;
use
Illuminate\Support\Facades\Storage
;
use
Illuminate\Support\Facades\Auth
;
use
Illuminate\Support\Facades\Log
;
...
...
@@ -80,6 +81,11 @@ class EventoController extends Controller
$user_id
=
Auth
()
->
user
()
->
id
;
//dd($user_id);
if
(
isset
(
$request
->
modeloDocumento
)){
$request
->
validate
([
'modeloDocumento'
=>
[
'file'
,
'max:2048'
,
new
ExcelRule
(
$request
->
file
(
'modeloDocumento'
))],
]);
}
//--Salvando os anexos da submissão temporariamente
$evento
=
$this
->
armazenarAnexosTemp
(
$request
);
...
...
@@ -105,8 +111,8 @@ class EventoController extends Controller
'inicioRevisao'
=>
[
'required'
,
'date'
],
'fimRevisao'
=>
[
'required'
,
'date'
],
'resultado'
=>
[
'required'
,
'date'
],
'pdfEdital'
=>
[(
$request
->
pdfEditalPreenchido
!==
'sim'
?
'required'
:
''
),
'file'
,
'mimes:pdf'
,
'max:20
00000
'
],
'modeloDocumento'
=>
[
'file'
,
'mimes:zip,doc,docx,odt,pdf'
,
'max:2000000'
],
'pdfEdital'
=>
[(
$request
->
pdfEditalPreenchido
!==
'sim'
?
'required'
:
''
),
'file'
,
'mimes:pdf'
,
'max:20
48
'
],
//
'modeloDocumento' => [],
]);
}
...
...
@@ -124,8 +130,8 @@ class EventoController extends Controller
'inicioRevisao'
=>
[
'required'
,
'date'
,
'after:'
.
$yesterday
],
'fimRevisao'
=>
[
'required'
,
'date'
,
'after:'
.
$request
->
inicioRevisao
],
'resultado'
=>
[
'required'
,
'date'
,
'after:'
.
$yesterday
],
'pdfEdital'
=>
[(
$request
->
pdfEditalPreenchido
!==
'sim'
?
'required'
:
''
),
'file'
,
'mimes:pdf'
,
'max:20
00000
'
],
'modeloDocumento'
=>
[
'file'
,
'mimes:zip,doc,docx,odt,pdf'
,
'max:20
00000
'
],
'pdfEdital'
=>
[(
$request
->
pdfEditalPreenchido
!==
'sim'
?
'required'
:
''
),
'file'
,
'mimes:pdf'
,
'max:20
48
'
],
//
'modeloDocumento' => ['file', 'mimes:zip,doc,docx,odt,pdf', 'max:20
48
'],
]);
//$evento = Evento::create([
...
...
@@ -329,8 +335,8 @@ class EventoController extends Controller
'inicioRevisao'
=>
[
'required'
,
'date'
],
'fimRevisao'
=>
[
'required'
,
'date'
],
'resultado'
=>
[
'required'
,
'date'
],
'pdfEdital'
=>
[
'file'
,
'mimes:pdf'
,
'max:20
00000
'
],
'modeloDocumento'
=>
[
'file'
,
'mimes:zip,doc,docx,odt,pdf'
,
'max:20
00000
'
],
'pdfEdital'
=>
[
'file'
,
'mimes:pdf'
,
'max:20
48
'
],
'modeloDocumento'
=>
[
'file'
,
'mimes:zip,doc,docx,odt,pdf'
,
'max:20
48
'
],
]);
}
...
...
@@ -344,8 +350,8 @@ class EventoController extends Controller
'inicioRevisao'
=>
[
'required'
,
'date'
,
'after:'
.
$yesterday
],
'fimRevisao'
=>
[
'required'
,
'date'
,
'after:'
.
$request
->
inicioRevisao
],
'resultado'
=>
[
'required'
,
'date'
,
'after:'
.
$yesterday
],
'pdfEdital'
=>
[
'file'
,
'mimes:pdf'
,
'max:20
00000
'
],
'modeloDocumento'
=>
[
'file'
,
'mimes:zip,doc,docx,odt,pdf'
,
'max:20
00000
'
],
'pdfEdital'
=>
[
'file'
,
'mimes:pdf'
,
'max:20
48
'
],
'modeloDocumento'
=>
[
'file'
,
'mimes:zip,doc,docx,odt,pdf'
,
'max:20
48
'
],
]);
$evento
->
nome
=
$request
->
nome
;
...
...
app/Http/Controllers/TrabalhoController.php
View file @
690fda6a
...
...
@@ -120,14 +120,14 @@ class TrabalhoController extends Controller
'funcaoParticipante.*'
=>
[
'required'
,
'string'
],
'nomePlanoTrabalho.*'
=>
[
'nullable'
,
'string'
],
//--Verificando se anexos já foram submetidos
'anexoProjeto'
=>
[(
$request
->
anexoProjetoPreenchido
!==
'sim'
?
'required'
:
''
),
'file'
,
'mimes:pdf'
,
'max:20
00000
'
],
'anexoCONSU'
=>
[(
$request
->
anexoConsuPreenchido
!==
'sim'
?
'required'
:
''
),
'file'
,
'mimes:pdf'
,
'max:20
00000
'
],
'anexoProjeto'
=>
[(
$request
->
anexoProjetoPreenchido
!==
'sim'
?
'required'
:
''
),
'file'
,
'mimes:pdf'
,
'max:20
48
'
],
'anexoCONSU'
=>
[(
$request
->
anexoConsuPreenchido
!==
'sim'
?
'required'
:
''
),
'file'
,
'mimes:pdf'
,
'max:20
48
'
],
'botao'
=>
[
'required'
],
'anexoComiteEtica'
=>
[(
$request
->
anexoComitePreenchido
!==
'sim'
&&
$request
->
anexoJustificativaPreenchido
!==
'sim'
?
'required_without:justificativaAutorizacaoEtica'
:
''
),
'file'
,
'mimes:pdf'
,
'max:20
00000
'
],
'justificativaAutorizacaoEtica'
=>
[(
$request
->
anexoJustificativaPreenchido
!==
'sim'
&&
$request
->
anexoComitePreenchido
!==
'sim'
?
'required_without:anexoComiteEtica'
:
''
),
'file'
,
'mimes:pdf'
,
'max:20
00000
'
],
'anexoLattesCoordenador'
=>
[(
$request
->
anexoLattesPreenchido
!==
'sim'
?
'required'
:
''
),
'file'
,
'mimes:pdf'
,
'max:20
00000
'
],
'anexoPlanilha'
=>
[(
$request
->
anexoPlanilhaPreenchido
!==
'sim'
?
'required'
:
''
),
'file'
,
'mimes:pdf,xls,xlsx'
,
'max:20
00000
'
],
'anexoPlanoTrabalho.*'
=>
[
'nullable'
,
'file'
,
'mimes:pdf'
,
'max:20
00000
'
],
'anexoComiteEtica'
=>
[(
$request
->
anexoComitePreenchido
!==
'sim'
&&
$request
->
anexoJustificativaPreenchido
!==
'sim'
?
'required_without:justificativaAutorizacaoEtica'
:
''
),
'file'
,
'mimes:pdf'
,
'max:20
48
'
],
'justificativaAutorizacaoEtica'
=>
[(
$request
->
anexoJustificativaPreenchido
!==
'sim'
&&
$request
->
anexoComitePreenchido
!==
'sim'
?
'required_without:anexoComiteEtica'
:
''
),
'file'
,
'mimes:pdf'
,
'max:20
48
'
],
'anexoLattesCoordenador'
=>
[(
$request
->
anexoLattesPreenchido
!==
'sim'
?
'required'
:
''
),
'file'
,
'mimes:pdf'
,
'max:20
48
'
],
'anexoPlanilha'
=>
[(
$request
->
anexoPlanilhaPreenchido
!==
'sim'
?
'required'
:
''
),
'file'
,
'mimes:pdf,xls,xlsx'
,
'max:20
48
'
],
'anexoPlanoTrabalho.*'
=>
[
'nullable'
,
'file'
,
'mimes:pdf'
,
'max:20
48
'
],
]);
if
(
gettype
(
$this
->
validarAnexosRascunho
(
$request
,
$trabalho
))
!=
'integer'
){
...
...
@@ -171,10 +171,10 @@ class TrabalhoController extends Controller
'emailParticipante.*'
=>
[
'required'
,
'string'
],
'funcaoParticipante.*'
=>
[
'required'
,
'string'
],
'nomePlanoTrabalho.*'
=>
[
'nullable'
,
'string'
],
'anexoProjeto'
=>
[(
$request
->
anexoProjetoPreenchido
!==
'sim'
?
'required'
:
''
),
'file'
,
'mimes:pdf'
,
'max:20
00000
'
],
'anexoLattesCoordenador'
=>
[(
$request
->
anexoLattesPreenchido
!==
'sim'
?
'required'
:
''
),
'file'
,
'mimes:pdf'
,
'max:20
00000
'
],
'anexoPlanilha'
=>
[(
$request
->
anexoPlanilhaPreenchido
!==
'sim'
?
'required'
:
''
),
'file'
,
'mimes:pdf,xls,xlsx'
,
'max:20
00000
'
],
'anexoPlanoTrabalho.*'
=>
[
'nullable'
,
'file'
,
'mimes:pdf'
,
'max:20
00000
'
],
'anexoProjeto'
=>
[(
$request
->
anexoProjetoPreenchido
!==
'sim'
?
'required'
:
''
),
'file'
,
'mimes:pdf'
,
'max:20
48
'
],
'anexoLattesCoordenador'
=>
[(
$request
->
anexoLattesPreenchido
!==
'sim'
?
'required'
:
''
),
'file'
,
'mimes:pdf'
,
'max:20
48
'
],
'anexoPlanilha'
=>
[(
$request
->
anexoPlanilhaPreenchido
!==
'sim'
?
'required'
:
''
),
'file'
,
'mimes:pdf,xls,xlsx'
,
'max:20
48
'
],
'anexoPlanoTrabalho.*'
=>
[
'nullable'
,
'file'
,
'mimes:pdf'
,
'max:20
48
'
],
]);
if
(
gettype
(
$this
->
validarAnexosRascunho
(
$request
,
$trabalho
))
!=
'integer'
){
...
...
app/Rules/ExcelRule.php
0 → 100644
View file @
690fda6a
<?php
namespace
App\Rules
;
use
Illuminate\Contracts\Validation\Rule
;
use
Illuminate\Http\UploadedFile
;
use
File
;
class
ExcelRule
implements
Rule
{
private
$file
;
public
function
__construct
(
UploadedFile
$file
)
{
$this
->
file
=
$file
;
}
public
function
passes
(
$attribute
,
$value
)
{
$extension
=
strtolower
(
$this
->
file
->
getClientOriginalExtension
());
return
in_array
(
$extension
,
[
'csv'
,
'xls'
,
'xlsx'
,
'pdf'
,
'zip'
,
'doc'
,
'docx'
,
'odt'
]);
}
public
function
message
()
{
return
'The excel file must be a file of type: csv, xls, xlsx, pdf, zip, doc, docx, odt'
;
}
}
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