Skip to content

Instantly share code, notes, and snippets.

@cursosdesarrolloweb
Created August 10, 2021 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cursosdesarrolloweb/d59ea2b2c6e8adc1eaa1133ca402ba22 to your computer and use it in GitHub Desktop.
Save cursosdesarrolloweb/d59ea2b2c6e8adc1eaa1133ca402ba22 to your computer and use it in GitHub Desktop.
<?php
use Illuminate\Support\Facades\Route;
use App\Models\User;
/**
* Banear usuarios
*/
Route::get("/ban-user", function () {
$user = User::first();
return tap($user)->ban([
"comment" => "Mala conducta",
"expired_at" => "+1 month",
]);
});
/**
* Rutas protegidas de usuarios baneados
*/
Route::group(["middleware" => ["auth", "forbid-banned-user"]], function () {
Route::get('/dashboard', function () {
return view('dashboard');
})->name('dashboard');
});
/**
* Ruta para mostrar información a los usuarios baneados
*/
Route::view("/banned", "banned");
require __DIR__.'/auth.php';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment