"resources/views/planosTrabalho/index.blade.php" did not exist on "b09fb79e3f72aa28e71af97781bdb19c9b29e021"
Commit 51c0c25c authored by Yuri Resende's avatar Yuri Resende
Browse files

Adicionando verificação na exclusão das ODSs

parent 67245ec5
......@@ -41,8 +41,12 @@ class ObjetivoDeDesenvolvimentoSustentavelController extends Controller
public function destroy($id)
{
$ODS = ObjetivoDeDesenvolvimentoSustentavel::find($id);
$ODS->delete();
if ($ODS->trabalhos()->first()){
return redirect( route('grandearea.index') )->with(['error' => 'Não foi possível excluir a ODS. Existe um ou mais trabalhos vinculados a ODS']);
}
$ODS->delete();
return redirect( route('grandearea.index') )->with(['mensagem' => 'ODS excluido com sucesso']);
}
}
......@@ -3,6 +3,15 @@
@section('content')
<div class="container" >
<div class="row" >
@if(session('error'))
<div class="col-md-12" style="margin-top: 30px;">
<div class="alert alert-danger">
<p>{{session('error')}}</p>
</div>
</div>
@endif
</div>
<div class="row" >
@if(session('mensagem'))
<div class="col-md-12" style="margin-top: 30px;">
......
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