Commit 4837b499 authored by Lucas Henrique's avatar Lucas Henrique
Browse files

Adicionando plano de trabalho ao proponente quando não há participantes

parent ea95e8c8
......@@ -1049,6 +1049,7 @@ class TrabalhoController extends Controller
]);
}
$evento = Evento::find($request->editalId);
$proponente = Proponente::where('user_id', Auth::user()->id)->first();
$request->merge([
'coordenador_id' => $evento->coordenadorComissao->id
]);
......@@ -1148,6 +1149,23 @@ class TrabalhoController extends Controller
}
}
} else {
$data['nomePlanoTrabalho'] = $request->nomePlanoTrabalho;
if ($request->has('anexoPlanoTrabalho')) {
$path = 'trabalhos/' . $evento->id . '/' . $trabalho->id . '/';
$nome = $data['nomePlanoTrabalho'] . ".pdf";
$file = $request->anexoPlanoTrabalho;
Storage::putFileAs($path, $file, $nome);
$arquivo = new Arquivo();
$arquivo->titulo = $data['nomePlanoTrabalho'];
$arquivo->nome = $path . $nome;
$arquivo->trabalhoId = $trabalho->id;
$arquivo->data = now();
$arquivo->proponenteId = $proponente->id;
$arquivo->versaoFinal = true;
$arquivo->save();
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment