laravel 8 route list long middleware classes code example
Example 1: laravel route controller
use App\Http\Controllers\UserController;
Route::get('user/{id}', [UserController::class, 'show']);
Example 2: laravel 8 routes namespace
Route::group(['namespace' => 'App\Http\Controllers', 'prefix' => 'admin',
'as' => 'admin.', 'middleware' => ['auth:sanctum', 'verified']], function()
{
Route::get('/dashboard', ['DashboardController', 'index']);
});
Example 3: laravel route match
Route::match(['get', 'post'], '/', function () {
});
Route::any('/', function () {
});
Example 4: comment = Comment::find($this->route('comment')); in laravel
Schema::create('comments', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users')->onCascade('update')->onDelete('cascade');
$table->integer('post_id')->unsigned();
$table->foreign('post_id')->references('id')->on('users')->onCascade('update')->onDelete('cascade');
$table->text('comment');
$table->timestamps();
$table->rememberToken();
});