Commit db162596 authored by alinetenorio's avatar alinetenorio
Browse files

sair de projeto

parent d5d47167
...@@ -539,6 +539,16 @@ class TrabalhoController extends Controller ...@@ -539,6 +539,16 @@ class TrabalhoController extends Controller
return redirect()->back(); return redirect()->back();
} }
public function excluirParticipante($id){
$participante = Participante::where('user_id', Auth()->user()->id)
->where('trabalho_id', $id)->first();
$participante->trabalhos()->detach($id);
$participante->delete();
return redirect()->back();
}
public function novaVersao(Request $request){ public function novaVersao(Request $request){
$mytime = Carbon::now('America/Recife'); $mytime = Carbon::now('America/Recife');
$mytime = $mytime->toDateString(); $mytime = $mytime->toDateString();
......
...@@ -3,9 +3,12 @@ ...@@ -3,9 +3,12 @@
namespace App; namespace App;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Participante extends Model class Participante extends Model
{ {
use SoftDeletes;
protected $fillable = ['name', 'user_id', 'trabalho_id', 'participante_id']; protected $fillable = ['name', 'user_id', 'trabalho_id', 'participante_id'];
public function user(){ public function user(){
......
...@@ -25,6 +25,8 @@ class CreateParticipantesTable extends Migration ...@@ -25,6 +25,8 @@ class CreateParticipantesTable extends Migration
$table->unsignedBigInteger('funcao_participante_id')->nullable(); $table->unsignedBigInteger('funcao_participante_id')->nullable();
$table->foreign('funcao_participante_id')->references('id')->on('funcao_participantes'); $table->foreign('funcao_participante_id')->references('id')->on('funcao_participantes');
$table->softDeletes();
}); });
} }
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
Visualizar projeto Visualizar projeto
</a> </a>
@if($projeto->status == 'Submetido') @if($projeto->status == 'Submetido')
<a href="{{ route('trabalho.destroy', ['id' => $projeto->id]) }}" class="dropdown-item" style="text-align: center"> <a href="{{ route('trabalho.excluirParticipante', ['id' => $projeto->id]) }}" class="dropdown-item" style="text-align: center">
Sair do projeto Sair do projeto
</a> </a>
@endif @endif
......
...@@ -96,6 +96,7 @@ Route::group(['middleware' => ['isTemp', 'auth', 'verified']], function(){ ...@@ -96,6 +96,7 @@ Route::group(['middleware' => ['isTemp', 'auth', 'verified']], function(){
Route::get( '/projeto/{id}/editar', 'TrabalhoController@edit' )->name('trabalho.editar'); Route::get( '/projeto/{id}/editar', 'TrabalhoController@edit' )->name('trabalho.editar');
Route::post( '/projeto/{id}/atualizar', 'TrabalhoController@update' )->name('trabalho.update'); Route::post( '/projeto/{id}/atualizar', 'TrabalhoController@update' )->name('trabalho.update');
Route::get( '/projeto/{id}/excluir', 'TrabalhoController@destroy' )->name('trabalho.destroy'); Route::get( '/projeto/{id}/excluir', 'TrabalhoController@destroy' )->name('trabalho.destroy');
Route::get( '/projeto/{id}/excluirParticipante', 'TrabalhoController@excluirParticipante')->name('trabalho.excluirParticipante');
//######### Atribuição ####################################### //######### Atribuição #######################################
Route::get( '/atribuir', 'AtribuicaoController@distribuicaoAutomatica' )->name('distribuicao'); Route::get( '/atribuir', 'AtribuicaoController@distribuicaoAutomatica' )->name('distribuicao');
......
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