Unverified Commit cc855494 authored by José Rômulo's avatar José Rômulo Committed by GitHub
Browse files

Merge pull request #166 from Gabriel-31415/master

ajuste em submeter proposta
parents 611cf910 150c75ee
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -795,14 +795,12 @@ class TrabalhoController extends Controller
$data['media_do_curso'] = $request->media_do_curso[$part];
$data['nomePlanoTrabalho'] = $request->nomePlanoTrabalho[$part];
$participante = Participante::find($request->participante_id[$part]);
// $participante = Participante::find($request->participante_id[$part]);
$user = User::where('email', $data['email'])->first();
if (!$participante){
if ($user == null){
$data['usuarioTemp'] = true;
$user = User::updateOrCreate(
['email' => $data['email']],
$data
);
$user = User::create($data);
$endereco = Endereco::create($data);
$endereco->user()->save($user);
$participante = Participante::create($data);
......@@ -810,16 +808,19 @@ class TrabalhoController extends Controller
$trabalho->participantes()->save($participante);
}else{
$user = $participante->user;
// $user = $participante->user;
$user->update($data);
$endereco = $user->endereco;
$endereco->update($data);
$participante = $user->participantes->where('trabalho_id', $trabalho->id)->first();
if (!$participante){
$participante = $user->participantes->where('trabalho_id', $trabalho->id)->where('id', $request->participante_id[$part])->first();
// dd($participante);
if ($participante == null){
// dd('part null');
$participante = Participante::create($data);
$user->participantes()->save($participante);
$trabalho->participantes()->save($participante);
}else{
// dd('part update');
$participante->update($data);
}
......@@ -943,20 +944,22 @@ class TrabalhoController extends Controller
$data['nomePlanoTrabalho'] = $request->nomePlanoTrabalho[$part];
$user = User::where('email' , $data['email'])->first();
if (!$user){
if ($user == null){
$data['usuarioTemp'] = true;
$user = User::create($data);
$endereco = Endereco::create($data);
$endereco->user()->save($user);
}
$participante = $user->participantes->where('trabalho_id', $trabalho->id)->first();
if (!$participante){
$participante = Participante::create($data);
}
// $participante = $user->participantes->where('trabalho_id', $trabalho->id)->first();
// if ($participante == null){
// $participante = Participante::create($data);
// }
$participante = Participante::create($data);
$user->participantes()->save($participante);
$trabalho->participantes()->save($participante);
$participante->trabalho_id = $trabalho->id;
$participante->save();
if ( $request->has('anexoPlanoTrabalho') ) {
$path = 'trabalhos/' . $evento->id . '/' . $trabalho->id .'/';
$nome = $data['nomePlanoTrabalho'] .".pdf";
......
......@@ -194,6 +194,7 @@ class UserController extends Controller
return view('user.meusTrabalhos',[
'trabalhos' => $trabalhos,
'agora' => now(),
]);
}
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
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