public function destroy($eventoId)
 {
     $participante = Participante::where('usuario_id', Auth::user()->id)->where('evento_id', $eventoId);
     if ($participante->delete()) {
         return redirect()->action('BackendController@index')->with('statusParticipante', 'Presença cancelada.');
     }
 }
Exemple #2
0
 public function usuarioEstaParticipando($usuarioId, $eventoId)
 {
     $participante = Participante::where('usuario_id', $usuarioId)->where('evento_id', $eventoId)->first();
     if (empty($participante)) {
         return false;
     }
     return true;
 }
Exemple #3
0
<?php

/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
    return view('welcome')->with('participantes', \App\Participante::all());
});
Route::post('/', 'ParticipanteController@criar');
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
Route::group(['middleware' => ['web']], function () {
    //
});