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
576b5454
Commit
576b5454
authored
May 25, 2020
by
Gabriel-31415
Browse files
refatoracao migrations
parent
19a258ed
Changes
33
Hide whitespace changes
Inline
Side-by-side
app/CoordenadorComissao.php
View file @
576b5454
...
...
@@ -14,4 +14,8 @@ class CoordenadorComissao extends Model
return
$this
->
hasMany
(
'App\Evento'
,
'coordenadorId'
);
}
public
function
trabalho
(){
return
$this
->
hasMany
(
'App\Trabalho'
);
}
}
app/Http/Controllers/EventoController.php
View file @
576b5454
...
...
@@ -11,6 +11,7 @@ use App\Atribuicao;
use
App\Modalidade
;
use
App\ComissaoEvento
;
use
App\User
;
use
App\Proponente
;
use
App\Trabalho
;
use
App\AreaModalidade
;
use
App\CoordenadorComissao
;
...
...
@@ -170,19 +171,30 @@ class EventoController extends Controller
public
function
show
(
$id
)
{
$evento
=
Evento
::
find
(
$id
);
$hasTrabalho
=
false
;
$hasTrabalhoCoautor
=
false
;
$hasFile
=
false
;
$trabalhos
=
Trabalho
::
where
(
'proponente_id'
,
Auth
::
user
()
->
id
)
->
get
();
$trabalhosCount
=
Trabalho
::
where
(
'proponente_id'
,
Auth
::
user
()
->
id
)
->
count
();
$proponente
=
Proponente
::
where
(
'user_id'
,
Auth
::
user
()
->
id
)
->
first
();
if
(
$proponente
=
null
){
$hasTrabalho
=
false
;
$hasFile
=
false
;
$trabalhos
=
$proponente
->
trabalhos
()
->
get
();
$trabalhosCount
=
$proponente
->
trabalhos
()
->
count
();
if
(
$trabalhosCount
!=
0
){
$hasTrabalho
=
true
;
$hasFile
=
true
;
}
}
else
{
$hasTrabalho
=
false
;
$hasFile
=
false
;
$trabalhos
=
0
;
$trabalhosCount
=
0
;
}
$trabalhosId
=
Trabalho
::
where
(
'evento_id'
,
$evento
->
id
)
->
select
(
'id'
)
->
get
();
//$trabalhosIdCoautor = Proponente::whereIn('trabalhoId', $trabalhosId)->where('proponente_id', Auth::user()->id)->select('trabalhoId')->get();
//$coautorCount = Coautor::whereIn('trabalhoId', $trabalhosId)->where('proponente_id', Auth::user()->id)->count();
//$trabalhosCoautor = Trabalho::whereIn('id', $trabalhosIdCoautor)->get();
if
(
$trabalhosCount
!=
0
){
$hasTrabalho
=
true
;
$hasFile
=
true
;
}
// if($coautorCount != 0){
// $hasTrabalhoCoautor = true;
// $hasFile = true;
...
...
app/Http/Controllers/TrabalhoController.php
View file @
576b5454
...
...
@@ -5,7 +5,9 @@ namespace App\Http\Controllers;
use
App\Trabalho
;
use
App\Coautor
;
use
App\Evento
;
use
App\CoordenadorComissao
;
use
App\User
;
use
App\Proponente
;
use
App\AreaModalidade
;
use
App\Area
;
use
App\Revisor
;
...
...
@@ -71,6 +73,8 @@ class TrabalhoController extends Controller
$mytime
=
Carbon
::
now
(
'America/Recife'
);
$mytime
=
$mytime
->
toDateString
();
$evento
=
Evento
::
find
(
$request
->
editalId
);
$coordenador
=
CoordenadorComissao
::
find
(
$evento
->
coordenadorId
);
//dd($coordenador->id);
if
(
$evento
->
inicioSubmissao
>
$mytime
){
if
(
$mytime
>=
$evento
->
fimSubmissao
){
...
...
@@ -83,19 +87,18 @@ class TrabalhoController extends Controller
$validatedData
=
$request
->
validate
([
'editalId'
=>
[
'required'
,
'integer'
],
'nomeProjeto'
=>
[
'required'
,
'string'
,
],
'nomeProjeto'
=>
[
'required'
,
'string'
],
'grandeAreaId'
=>
[
'required'
,
'integer'
],
'areaId'
=>
[
'required'
,
'integer'
],
'subAreaId'
=>
[
'required'
,
'integer'
],
'pontuacaoPlanilha'
=>
[
'required'
,
'integer'
],
'linkGrupo'
=>
[
'required'
,
'string'
],
'linkLattesEstudante'
=>
[
'required'
,
'string'
],
'nomeCoordenador'
=>
[
'required'
,
'string'
],
'nomeParticipante.*'
=>
[
'required'
,
'string'
],
'emailParticipante.*'
=>
[
'string'
],
'nomePlanoTrabalho.*'
=>
[
'string'
],
'anexoProjeto'
=>
[
'required'
,
'file'
,
'mimes:pdf'
,
'max:2000000'
],
'anexoCONSU'
=>
[
'required'
,
'file'
,
'mimes:pdf'
,
'max:2000000'
],
//
'anexoCONSU' => ['required', 'file', 'mimes:pdf', 'max:2000000'],
'anexoLatterCoordenador'
=>
[
'required'
,
'file'
,
'mimes:pdf'
,
'max:2000000'
],
'anexoPlanilha'
=>
[
'required'
,
'file'
,
'mimes:pdf'
,
'max:2000000'
],
'anexoPlanoTrabalho.*'
=>
[
'required'
,
'file'
,
'mimes:pdf'
,
'max:2000000'
],
...
...
@@ -103,10 +106,10 @@ class TrabalhoController extends Controller
$trabalho
=
Trabalho
::
create
([
'titulo'
=>
$request
->
nomeProjeto
,
'coordenador_id'
=>
$coordenador
->
id
,
'grande_area_id'
=>
$request
->
grandeAreaId
,
'area_id'
=>
$request
->
areaId
,
'sub_area_id'
=>
$request
->
subAreaId
,
'coordenador'
=>
$request
->
nomeCoordenador
,
'sub_area_id'
=>
$request
->
subAreaId
,
'pontuacaoPlanilha'
=>
$request
->
pontuacaoPlanilha
,
'linkGrupoPesquisa'
=>
$request
->
linkGrupo
,
'linkLattesEstudante'
=>
$request
->
linkLattesEstudante
,
...
...
@@ -120,6 +123,7 @@ class TrabalhoController extends Controller
'anexoLattesCoordenador'
=>
$request
->
anexoLatterCoordenador
,
'anexoPlanilhaPontuacao'
=>
$request
->
anexoPlanilha
,
]);
//dd($request->all());
}
else
{
//Caso em que o anexo da Decisão do CONSU não necessário
$validatedData
=
$request
->
validate
([
...
...
@@ -143,6 +147,7 @@ class TrabalhoController extends Controller
$trabalho
=
Trabalho
::
create
([
'titulo'
=>
$request
->
nomeProjeto
,
'coordenador_id'
=>
$coordenador
->
id
,
'grande_area_id'
=>
$request
->
grandeAreaId
,
'area_id'
=>
$request
->
areaId
,
'sub_area_id'
=>
$request
->
subAreaId
,
...
...
@@ -163,7 +168,8 @@ class TrabalhoController extends Controller
}
//Relaciona o projeto criado com o proponente que criou o projeto
$trabalho
->
proponente
()
->
save
(
Auth
()
->
user
());
$proponente
=
Proponente
::
where
(
'user_id'
,
Auth
::
user
()
->
id
)
->
first
();
$trabalho
->
proponentes
()
->
save
(
$proponente
);
//Envia email com senha temp para cada participante do projeto
if
(
$request
->
emailParticipante
!=
null
){
...
...
app/Trabalho.php
View file @
576b5454
...
...
@@ -31,6 +31,7 @@ class Trabalho extends Model
'sub_area_id'
,
'evento_id'
,
'proponente_id'
,
'coordenador_id'
,
];
public
function
recurso
(){
...
...
@@ -77,4 +78,7 @@ class Trabalho extends Model
public
function
proponentes
(){
return
$this
->
belongsToMany
(
'App\Proponente'
,
'trabalho_proponente'
);
}
public
function
coordenador
(){
return
$this
->
belongsTo
(
'App\CoordenadorComissao'
);
}
}
database/migrations/2014_10_12_000000_create_users_table.php
View file @
576b5454
...
...
@@ -22,7 +22,8 @@ class CreateUsersTable extends Migration
$table
->
string
(
'celular'
)
->
nullable
();
$table
->
string
(
'cpf'
)
->
nullable
();
$table
->
string
(
'tipo'
)
->
nullable
();
$table
->
boolean
(
'usuarioTemp'
)
->
nullable
();
$table
->
boolean
(
'usuarioTemp'
)
->
nullable
();
$table
->
rememberToken
();
$table
->
timestamps
();
$table
->
timestamp
(
'email_verified_at'
)
->
nullable
();
...
...
database/migrations/2020_02_05_123048_create_trabalhos_table.php
View file @
576b5454
...
...
@@ -32,7 +32,7 @@ class CreateTrabalhosTable extends Migration
$table
->
unsignedBigInteger
(
'area_id'
);
$table
->
unsignedBigInteger
(
'sub_area_id'
);
$table
->
unsignedBigInteger
(
'evento_id'
);
$table
->
unsignedBigInteger
(
'
proponente
_id'
);
$table
->
unsignedBigInteger
(
'
coordenador
_id'
);
$table
->
timestamps
();
});
...
...
database/migrations/2020_02_05_123139_create_areas_table.php
View file @
576b5454
...
...
@@ -17,6 +17,7 @@ class CreateAreasTable extends Migration
$table
->
bigIncrements
(
'id'
);
$table
->
string
(
'nome'
);
$table
->
unsignedBigInteger
(
'grande_area_id'
);
$table
->
timestamps
();
// $table->integer('modalidadeId')->nullable();
// $table->integer('eventoId');
...
...
database/migrations/2020_05_20_163253_create_administradors_table.php
View file @
576b5454
...
...
@@ -14,9 +14,13 @@ class CreateAdministradorsTable extends Migration
public
function
up
()
{
Schema
::
create
(
'administradors'
,
function
(
Blueprint
$table
)
{
$table
->
bigIncrements
(
'id'
);
/*Igor pediu que as PK das tabelas fossem o id */
$table
->
bigIncrements
(
'id'
);
$table
->
string
(
'matricula'
)
->
unique
();
$table
->
timestamps
();
$table
->
unsignedBigInteger
(
'user_id'
);
$table
->
foreign
(
'user_id'
)
->
references
(
'id'
)
->
on
(
'users'
);
});
}
...
...
database/migrations/2020_05_20_163721_add_users_to_administradors_table.php
deleted
100644 → 0
View file @
19a258ed
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
AddUsersToAdministradorsTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
table
(
'administradors'
,
function
(
Blueprint
$table
)
{
$table
->
unsignedBigInteger
(
'user_id'
);
$table
->
foreign
(
'user_id'
)
->
references
(
'id'
)
->
on
(
'users'
);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
table
(
'administradors'
,
function
(
Blueprint
$table
)
{
//
$table
->
dropForeign
(
'administradors_user_id_foreign'
);
$table
->
dropColumn
(
'user_id'
);
});
}
}
database/migrations/2020_05_20_211421_create_proponentes_table.php
View file @
576b5454
...
...
@@ -29,6 +29,10 @@ class CreateProponentesTable extends Migration
$table
->
string
(
'nivel'
);
$table
->
string
(
'linkLattes'
);
$table
->
timestamps
();
$table
->
unsignedBigInteger
(
'user_id'
);
$table
->
foreign
(
'user_id'
)
->
references
(
'id'
)
->
on
(
'users'
);
});
}
...
...
database/migrations/2020_05_20_211451_add_users_to_proponentes_table.php
deleted
100644 → 0
View file @
19a258ed
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
AddUsersToProponentesTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
table
(
'proponentes'
,
function
(
Blueprint
$table
)
{
$table
->
unsignedBigInteger
(
'user_id'
);
$table
->
foreign
(
'user_id'
)
->
references
(
'id'
)
->
on
(
'users'
);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
table
(
'proponentes'
,
function
(
Blueprint
$table
)
{
$table
->
dropForeign
(
'proponentes_user_id_foreign'
);
$table
->
dropColumn
(
'user_id'
);
});
}
}
database/migrations/2020_05_21_014825_add_trabalhos_to_proponentes_table.php
deleted
100644 → 0
View file @
19a258ed
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
AddTrabalhosToProponentesTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
table
(
'proponentes'
,
function
(
Blueprint
$table
)
{
$table
->
unsignedBigInteger
(
'trabalho_id'
)
->
nullable
();
$table
->
foreign
(
'trabalho_id'
)
->
references
(
'id'
)
->
on
(
'trabalhos'
);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
table
(
'proponentes'
,
function
(
Blueprint
$table
)
{
$table
->
dropForeign
(
'proponentes_trabalho_id_foreign'
);
$table
->
dropColumn
(
'trabalho_id'
);
});
}
}
database/migrations/2020_05_21_020029_create_plano_trabalhos_table.php
View file @
576b5454
...
...
@@ -18,6 +18,9 @@ class CreatePlanoTrabalhosTable extends Migration
$table
->
string
(
'titulo'
);
$table
->
string
(
'anexoPlanoTrabalho'
);
$table
->
timestamps
();
$table
->
unsignedBigInteger
(
'trabalho_id'
);
$table
->
foreign
(
'trabalho_id'
)
->
references
(
'id'
)
->
on
(
'trabalhos'
);
});
}
...
...
database/migrations/2020_05_21_020133_add_trabalhos_to_plano_trabalhos_table.php
deleted
100644 → 0
View file @
19a258ed
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
AddTrabalhosToPlanoTrabalhosTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
table
(
'plano_trabalhos'
,
function
(
Blueprint
$table
)
{
$table
->
unsignedBigInteger
(
'trabalho_id'
);
$table
->
foreign
(
'trabalho_id'
)
->
references
(
'id'
)
->
on
(
'trabalhos'
);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
table
(
'plano_trabalhos'
,
function
(
Blueprint
$table
)
{
$table
->
dropForeign
(
'plano_trabalhos_trabalho_id_foreign'
);
$table
->
dropColumn
(
'trabalho_id'
);
});
}
}
database/migrations/2020_05_21_025543_create_administrador_responsavels_table.php
View file @
576b5454
...
...
@@ -16,6 +16,9 @@ class CreateAdministradorResponsavelsTable extends Migration
Schema
::
create
(
'administrador_responsavels'
,
function
(
Blueprint
$table
)
{
$table
->
bigIncrements
(
'id'
);
$table
->
timestamps
();
$table
->
unsignedBigInteger
(
'user_id'
);
$table
->
foreign
(
'user_id'
)
->
references
(
'id'
)
->
on
(
'users'
);
});
}
...
...
database/migrations/2020_05_21_025624_add_users_to_administrador_responsavels_table.php
deleted
100644 → 0
View file @
19a258ed
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
AddUsersToAdministradorResponsavelsTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
table
(
'administrador_responsavels'
,
function
(
Blueprint
$table
)
{
$table
->
unsignedBigInteger
(
'user_id'
);
$table
->
foreign
(
'user_id'
)
->
references
(
'id'
)
->
on
(
'users'
);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
table
(
'administrador_responsavels'
,
function
(
Blueprint
$table
)
{
$table
->
dropForeign
(
'administrador_responsavels_user_id_foreign'
);
$table
->
dropColumn
(
'user_id'
);
});
}
}
database/migrations/2020_05_22_031644_create_grande_areas_table.php
View file @
576b5454
...
...
@@ -16,7 +16,7 @@ class CreateGrandeAreasTable extends Migration
Schema
::
create
(
'grande_areas'
,
function
(
Blueprint
$table
)
{
$table
->
bigIncrements
(
'id'
);
$table
->
string
(
'nome'
);
$table
->
timestamps
();
$table
->
timestamps
();
});
}
...
...
database/migrations/2020_05_22_031838_create_sub_areas_table.php
View file @
576b5454
...
...
@@ -17,6 +17,10 @@ class CreateSubAreasTable extends Migration
$table
->
bigIncrements
(
'id'
);
$table
->
string
(
"nome"
);
$table
->
timestamps
();
$table
->
unsignedBigInteger
(
'area_id'
);
$table
->
foreign
(
'area_id'
)
->
references
(
'id'
)
->
on
(
'areas'
);
});
}
...
...
database/migrations/2020_05_22_032753_add_areas_to_sub_areas_table.php
deleted
100644 → 0
View file @
19a258ed
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
AddAreasToSubAreasTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
table
(
'sub_areas'
,
function
(
Blueprint
$table
)
{
$table
->
unsignedBigInteger
(
'area_id'
);
$table
->
foreign
(
'area_id'
)
->
references
(
'id'
)
->
on
(
'areas'
);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
table
(
'sub_areas'
,
function
(
Blueprint
$table
)
{
$table
->
dropForeign
(
'sub_areas_area_id_foreign'
);
$table
->
dropColumn
(
'area_id'
);
});
}
}
database/migrations/2020_05_22_044450_create_funcao_participantes_table.php
View file @
576b5454
...
...
@@ -17,6 +17,8 @@ class CreateFuncaoParticipantesTable extends Migration
$table
->
bigIncrements
(
'id'
);
$table
->
string
(
'nome'
);
$table
->
timestamps
();
});
}
...
...
Prev
1
2
Next
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