From 576b5454bc6aaf7854f160955e918ae75ce773a4 Mon Sep 17 00:00:00 2001 From: Gabriel-31415 Date: Mon, 25 May 2020 19:47:22 +0000 Subject: [PATCH] refatoracao migrations --- app/CoordenadorComissao.php | 4 ++ app/Http/Controllers/EventoController.php | 30 +++++++++---- app/Http/Controllers/TrabalhoController.php | 18 +++++--- app/Trabalho.php | 4 ++ .../2014_10_12_000000_create_users_table.php | 3 +- ...20_02_05_123048_create_trabalhos_table.php | 2 +- .../2020_02_05_123139_create_areas_table.php | 1 + ..._20_163253_create_administradors_table.php | 6 ++- ...3721_add_users_to_administradors_table.php | 35 --------------- ..._05_20_211421_create_proponentes_table.php | 4 ++ ..._211451_add_users_to_proponentes_table.php | 34 -------------- ...825_add_trabalhos_to_proponentes_table.php | 34 -------------- ...21_020029_create_plano_trabalhos_table.php | 3 ++ ...add_trabalhos_to_plano_trabalhos_table.php | 34 -------------- ...reate_administrador_responsavels_table.php | 3 ++ ...rs_to_administrador_responsavels_table.php | 34 -------------- ...05_22_031644_create_grande_areas_table.php | 2 +- ...20_05_22_031838_create_sub_areas_table.php | 4 ++ ...22_032753_add_areas_to_sub_areas_table.php | 34 -------------- ...4450_create_funcao_participantes_table.php | 2 + ...dd_users_to_funcao_participantes_table.php | 34 -------------- ...649_create_coordenador_comissaos_table.php | 3 ++ ...d_users_to_coordenador_comissaos_table.php | 34 -------------- ...0_05_23_054805_create_avaliadors_table.php | 3 ++ ...3_054859_add_users_to_avaliadors_table.php | 34 -------------- ...5_23_054945_create_participantes_table.php | 8 ++++ ...55033_add_users_to_participantes_table.php | 36 --------------- ..._071949_add_foreign_to_trabalhos_table.php | 2 +- ...25_193809_add_grande_areas_area_table.php} | 6 +-- database/seeds/DatabaseSeeder.php | 2 +- database/seeds/ProponenteSeeder.php | 1 + .../views/evento/submeterTrabalho.blade.php | 2 +- resources/views/layouts/app.blade.php | 45 +++++++++++++++---- 33 files changed, 124 insertions(+), 377 deletions(-) delete mode 100644 database/migrations/2020_05_20_163721_add_users_to_administradors_table.php delete mode 100644 database/migrations/2020_05_20_211451_add_users_to_proponentes_table.php delete mode 100644 database/migrations/2020_05_21_014825_add_trabalhos_to_proponentes_table.php delete mode 100644 database/migrations/2020_05_21_020133_add_trabalhos_to_plano_trabalhos_table.php delete mode 100644 database/migrations/2020_05_21_025624_add_users_to_administrador_responsavels_table.php delete mode 100644 database/migrations/2020_05_22_032753_add_areas_to_sub_areas_table.php delete mode 100644 database/migrations/2020_05_22_044629_add_users_to_funcao_participantes_table.php delete mode 100644 database/migrations/2020_05_23_054741_add_users_to_coordenador_comissaos_table.php delete mode 100644 database/migrations/2020_05_23_054859_add_users_to_avaliadors_table.php delete mode 100644 database/migrations/2020_05_23_055033_add_users_to_participantes_table.php rename database/migrations/{2020_05_22_032714_add_grande_areas_to_areas_table.php => 2020_05_25_193809_add_grande_areas_area_table.php} (72%) diff --git a/app/CoordenadorComissao.php b/app/CoordenadorComissao.php index f5a2528..ff8f195 100644 --- a/app/CoordenadorComissao.php +++ b/app/CoordenadorComissao.php @@ -14,4 +14,8 @@ class CoordenadorComissao extends Model return $this->hasMany('App\Evento', 'coordenadorId'); } + public function trabalho(){ + return $this->hasMany('App\Trabalho'); + } + } diff --git a/app/Http/Controllers/EventoController.php b/app/Http/Controllers/EventoController.php index 51687d8..180ac8c 100644 --- a/app/Http/Controllers/EventoController.php +++ b/app/Http/Controllers/EventoController.php @@ -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; diff --git a/app/Http/Controllers/TrabalhoController.php b/app/Http/Controllers/TrabalhoController.php index bbde486..621c91b 100644 --- a/app/Http/Controllers/TrabalhoController.php +++ b/app/Http/Controllers/TrabalhoController.php @@ -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){ diff --git a/app/Trabalho.php b/app/Trabalho.php index 3092579..c19ebe6 100644 --- a/app/Trabalho.php +++ b/app/Trabalho.php @@ -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'); + } } diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 55ad718..67fb576 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -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(); diff --git a/database/migrations/2020_02_05_123048_create_trabalhos_table.php b/database/migrations/2020_02_05_123048_create_trabalhos_table.php index ff970a8..26e4133 100644 --- a/database/migrations/2020_02_05_123048_create_trabalhos_table.php +++ b/database/migrations/2020_02_05_123048_create_trabalhos_table.php @@ -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(); }); diff --git a/database/migrations/2020_02_05_123139_create_areas_table.php b/database/migrations/2020_02_05_123139_create_areas_table.php index aa1ca0b..57b4d0d 100644 --- a/database/migrations/2020_02_05_123139_create_areas_table.php +++ b/database/migrations/2020_02_05_123139_create_areas_table.php @@ -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'); diff --git a/database/migrations/2020_05_20_163253_create_administradors_table.php b/database/migrations/2020_05_20_163253_create_administradors_table.php index 33231fa..b500b62 100644 --- a/database/migrations/2020_05_20_163253_create_administradors_table.php +++ b/database/migrations/2020_05_20_163253_create_administradors_table.php @@ -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'); }); } diff --git a/database/migrations/2020_05_20_163721_add_users_to_administradors_table.php b/database/migrations/2020_05_20_163721_add_users_to_administradors_table.php deleted file mode 100644 index baf1acf..0000000 --- a/database/migrations/2020_05_20_163721_add_users_to_administradors_table.php +++ /dev/null @@ -1,35 +0,0 @@ -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'); - }); - } -} diff --git a/database/migrations/2020_05_20_211421_create_proponentes_table.php b/database/migrations/2020_05_20_211421_create_proponentes_table.php index 317d8a4..b80eb9c 100644 --- a/database/migrations/2020_05_20_211421_create_proponentes_table.php +++ b/database/migrations/2020_05_20_211421_create_proponentes_table.php @@ -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'); + }); } diff --git a/database/migrations/2020_05_20_211451_add_users_to_proponentes_table.php b/database/migrations/2020_05_20_211451_add_users_to_proponentes_table.php deleted file mode 100644 index 232eef6..0000000 --- a/database/migrations/2020_05_20_211451_add_users_to_proponentes_table.php +++ /dev/null @@ -1,34 +0,0 @@ -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'); - }); - } -} diff --git a/database/migrations/2020_05_21_014825_add_trabalhos_to_proponentes_table.php b/database/migrations/2020_05_21_014825_add_trabalhos_to_proponentes_table.php deleted file mode 100644 index ffbc2c0..0000000 --- a/database/migrations/2020_05_21_014825_add_trabalhos_to_proponentes_table.php +++ /dev/null @@ -1,34 +0,0 @@ -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'); - }); - } -} diff --git a/database/migrations/2020_05_21_020029_create_plano_trabalhos_table.php b/database/migrations/2020_05_21_020029_create_plano_trabalhos_table.php index e339b50..26e51d2 100644 --- a/database/migrations/2020_05_21_020029_create_plano_trabalhos_table.php +++ b/database/migrations/2020_05_21_020029_create_plano_trabalhos_table.php @@ -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'); }); } diff --git a/database/migrations/2020_05_21_020133_add_trabalhos_to_plano_trabalhos_table.php b/database/migrations/2020_05_21_020133_add_trabalhos_to_plano_trabalhos_table.php deleted file mode 100644 index 11e27ed..0000000 --- a/database/migrations/2020_05_21_020133_add_trabalhos_to_plano_trabalhos_table.php +++ /dev/null @@ -1,34 +0,0 @@ -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'); - }); - } -} diff --git a/database/migrations/2020_05_21_025543_create_administrador_responsavels_table.php b/database/migrations/2020_05_21_025543_create_administrador_responsavels_table.php index ab128e3..61a3713 100644 --- a/database/migrations/2020_05_21_025543_create_administrador_responsavels_table.php +++ b/database/migrations/2020_05_21_025543_create_administrador_responsavels_table.php @@ -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'); }); } diff --git a/database/migrations/2020_05_21_025624_add_users_to_administrador_responsavels_table.php b/database/migrations/2020_05_21_025624_add_users_to_administrador_responsavels_table.php deleted file mode 100644 index d20d2e1..0000000 --- a/database/migrations/2020_05_21_025624_add_users_to_administrador_responsavels_table.php +++ /dev/null @@ -1,34 +0,0 @@ -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'); - }); - } -} diff --git a/database/migrations/2020_05_22_031644_create_grande_areas_table.php b/database/migrations/2020_05_22_031644_create_grande_areas_table.php index 553f605..66c5c35 100644 --- a/database/migrations/2020_05_22_031644_create_grande_areas_table.php +++ b/database/migrations/2020_05_22_031644_create_grande_areas_table.php @@ -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(); }); } diff --git a/database/migrations/2020_05_22_031838_create_sub_areas_table.php b/database/migrations/2020_05_22_031838_create_sub_areas_table.php index d7fe6e6..4c6ec46 100644 --- a/database/migrations/2020_05_22_031838_create_sub_areas_table.php +++ b/database/migrations/2020_05_22_031838_create_sub_areas_table.php @@ -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'); }); } diff --git a/database/migrations/2020_05_22_032753_add_areas_to_sub_areas_table.php b/database/migrations/2020_05_22_032753_add_areas_to_sub_areas_table.php deleted file mode 100644 index baa6be6..0000000 --- a/database/migrations/2020_05_22_032753_add_areas_to_sub_areas_table.php +++ /dev/null @@ -1,34 +0,0 @@ -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'); - }); - } -} diff --git a/database/migrations/2020_05_22_044450_create_funcao_participantes_table.php b/database/migrations/2020_05_22_044450_create_funcao_participantes_table.php index 0df1c12..0ea3230 100644 --- a/database/migrations/2020_05_22_044450_create_funcao_participantes_table.php +++ b/database/migrations/2020_05_22_044450_create_funcao_participantes_table.php @@ -17,6 +17,8 @@ class CreateFuncaoParticipantesTable extends Migration $table->bigIncrements('id'); $table->string('nome'); $table->timestamps(); + + }); } diff --git a/database/migrations/2020_05_22_044629_add_users_to_funcao_participantes_table.php b/database/migrations/2020_05_22_044629_add_users_to_funcao_participantes_table.php deleted file mode 100644 index 3f92624..0000000 --- a/database/migrations/2020_05_22_044629_add_users_to_funcao_participantes_table.php +++ /dev/null @@ -1,34 +0,0 @@ -unsignedBigInteger('funcao_participante_id')->nullable();; - $table->foreign('funcao_participante_id')->references('id')->on('funcao_participantes'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('users', function (Blueprint $table) { - $table->dropForeign('users_funcao_participante_id_foreign'); - $table->dropColumn('funcao_participante_id'); - }); - } -} diff --git a/database/migrations/2020_05_23_054649_create_coordenador_comissaos_table.php b/database/migrations/2020_05_23_054649_create_coordenador_comissaos_table.php index 88d8d24..c519b8b 100644 --- a/database/migrations/2020_05_23_054649_create_coordenador_comissaos_table.php +++ b/database/migrations/2020_05_23_054649_create_coordenador_comissaos_table.php @@ -16,6 +16,9 @@ class CreateCoordenadorComissaosTable extends Migration Schema::create('coordenador_comissaos', function (Blueprint $table) { $table->bigIncrements('id'); $table->timestamps(); + + $table->unsignedBigInteger('user_id'); + $table->foreign('user_id')->references('id')->on('users'); }); } diff --git a/database/migrations/2020_05_23_054741_add_users_to_coordenador_comissaos_table.php b/database/migrations/2020_05_23_054741_add_users_to_coordenador_comissaos_table.php deleted file mode 100644 index a5a7e30..0000000 --- a/database/migrations/2020_05_23_054741_add_users_to_coordenador_comissaos_table.php +++ /dev/null @@ -1,34 +0,0 @@ -unsignedBigInteger('user_id'); - $table->foreign('user_id')->references('id')->on('users'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('coordenador_comissaos', function (Blueprint $table) { - $table->dropForeign('coordenador_comissaos_user_id_foreign'); - $table->dropColumn('user_id'); - }); - } -} diff --git a/database/migrations/2020_05_23_054805_create_avaliadors_table.php b/database/migrations/2020_05_23_054805_create_avaliadors_table.php index 72c8866..54a9372 100644 --- a/database/migrations/2020_05_23_054805_create_avaliadors_table.php +++ b/database/migrations/2020_05_23_054805_create_avaliadors_table.php @@ -16,6 +16,9 @@ class CreateAvaliadorsTable extends Migration Schema::create('avaliadors', function (Blueprint $table) { $table->bigIncrements('id'); $table->timestamps(); + + $table->unsignedBigInteger('user_id'); + $table->foreign('user_id')->references('id')->on('users'); }); } diff --git a/database/migrations/2020_05_23_054859_add_users_to_avaliadors_table.php b/database/migrations/2020_05_23_054859_add_users_to_avaliadors_table.php deleted file mode 100644 index edecce5..0000000 --- a/database/migrations/2020_05_23_054859_add_users_to_avaliadors_table.php +++ /dev/null @@ -1,34 +0,0 @@ -unsignedBigInteger('user_id'); - $table->foreign('user_id')->references('id')->on('users'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('avaliadors', function (Blueprint $table) { - $table->dropForeign('avaliadors_user_id_foreign'); - $table->dropColumn('user_id'); - }); - } -} diff --git a/database/migrations/2020_05_23_054945_create_participantes_table.php b/database/migrations/2020_05_23_054945_create_participantes_table.php index a0132d8..0a00499 100644 --- a/database/migrations/2020_05_23_054945_create_participantes_table.php +++ b/database/migrations/2020_05_23_054945_create_participantes_table.php @@ -16,6 +16,14 @@ class CreateParticipantesTable extends Migration Schema::create('participantes', function (Blueprint $table) { $table->bigIncrements('id'); $table->timestamps(); + + $table->unsignedBigInteger('user_id')->nullable(); + $table->foreign('user_id')->references('id')->on('users'); + $table->unsignedBigInteger('trabalho_id')->nullable(); + $table->foreign('trabalho_id')->references('id')->on('trabalhos'); + + $table->unsignedBigInteger('funcao_participante_id')->nullable(); + $table->foreign('funcao_participante_id')->references('id')->on('funcao_participantes'); }); } diff --git a/database/migrations/2020_05_23_055033_add_users_to_participantes_table.php b/database/migrations/2020_05_23_055033_add_users_to_participantes_table.php deleted file mode 100644 index 19e71cf..0000000 --- a/database/migrations/2020_05_23_055033_add_users_to_participantes_table.php +++ /dev/null @@ -1,36 +0,0 @@ -unsignedBigInteger('user_id')->nullable(); - $table->foreign('user_id')->references('id')->on('users'); - $table->unsignedBigInteger('trabalho_id')->nullable(); - $table->foreign('trabalho_id')->references('id')->on('trabalhos'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('participantes', function (Blueprint $table) { - $table->dropForeign('participantes_user_id_foreign'); - $table->dropColumn('user_id'); - }); - } -} diff --git a/database/migrations/2020_05_23_071949_add_foreign_to_trabalhos_table.php b/database/migrations/2020_05_23_071949_add_foreign_to_trabalhos_table.php index 3f33152..61c88c2 100644 --- a/database/migrations/2020_05_23_071949_add_foreign_to_trabalhos_table.php +++ b/database/migrations/2020_05_23_071949_add_foreign_to_trabalhos_table.php @@ -19,7 +19,7 @@ class AddForeignToTrabalhosTable extends Migration $table->foreign('area_id')->references('id')->on('areas'); $table->foreign('sub_area_id')->references('id')->on('sub_areas'); $table->foreign('evento_id')->references('id')->on('eventos'); - $table->foreign('proponente_id')->references('id')->on('proponentes'); + $table->foreign('coordenador_id')->references('id')->on('coordenador_comissaos'); //$table->foreignId('user_id')->constrained(); // $table->integer('coordenador'); diff --git a/database/migrations/2020_05_22_032714_add_grande_areas_to_areas_table.php b/database/migrations/2020_05_25_193809_add_grande_areas_area_table.php similarity index 72% rename from database/migrations/2020_05_22_032714_add_grande_areas_to_areas_table.php rename to database/migrations/2020_05_25_193809_add_grande_areas_area_table.php index c732329..ed7da9a 100644 --- a/database/migrations/2020_05_22_032714_add_grande_areas_to_areas_table.php +++ b/database/migrations/2020_05_25_193809_add_grande_areas_area_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class AddGrandeAreasToAreasTable extends Migration +class AddGrandeAreasAreaTable extends Migration { /** * Run the migrations. @@ -14,7 +14,6 @@ class AddGrandeAreasToAreasTable extends Migration public function up() { Schema::table('areas', function (Blueprint $table) { - $table->unsignedBigInteger('grande_area_id'); $table->foreign('grande_area_id')->references('id')->on('grande_areas'); }); } @@ -27,8 +26,7 @@ class AddGrandeAreasToAreasTable extends Migration public function down() { Schema::table('areas', function (Blueprint $table) { - $table->dropForeign('areas_grande_area_id_foreign'); - $table->dropColumn('grande_area_id'); + // }); } } diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index 3f8cf25..b3c7ad6 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -71,7 +71,7 @@ class DatabaseSeeder extends Seeder 'descricao'=>'Cada autor inscrito poderá submeter até dois (2) resumos; O número máximo de autores por trabalho será seis autores; Os trabalhos deverão ser submetidos na forma de resumo simples com no máximo uma (01) página, no formato PDF;', - 'tipo'=>'teste', + 'tipo'=>'PIBIC', 'inicioSubmissao'=>'2020-03-30', 'fimSubmissao'=>'2020-09-20', 'inicioRevisao'=>'2020-04-21', diff --git a/database/seeds/ProponenteSeeder.php b/database/seeds/ProponenteSeeder.php index 357c68a..69615fb 100644 --- a/database/seeds/ProponenteSeeder.php +++ b/database/seeds/ProponenteSeeder.php @@ -30,6 +30,7 @@ class ProponenteSeeder extends Seeder 'bolsistaProdutividade' => '123123123', 'nivel' => '123123123', 'linkLattes' => '123123123', + 'created_at' => '2020-01-01 00:00:00' ]); } diff --git a/resources/views/evento/submeterTrabalho.blade.php b/resources/views/evento/submeterTrabalho.blade.php index af47298..eadb024 100644 --- a/resources/views/evento/submeterTrabalho.blade.php +++ b/resources/views/evento/submeterTrabalho.blade.php @@ -208,7 +208,7 @@ - + @if($edital->tipo == 'PIBIC' || $edital->tipo == 'PIBIC-EM') {{-- Decisão do CONSU --}}
diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 5b244c4..b525f13 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -58,6 +58,9 @@ @else @if(Auth::user()->tipo == 'administrador') + @@ -180,17 +188,38 @@ @endif @if(Auth::user()->tipo == 'proponente') + + + + @endif @if(Auth::user()->tipo == 'participante') -- GitLab