Skip to content

Instantly share code, notes, and snippets.

@cursosdesarrolloweb
Created Aug 10, 2021
Embed
What would you like to do?
<?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