A
A
Alexander2022-03-29 23:24:18
PHP
Alexander, 2022-03-29 23:24:18

What's wrong with Laravel route?

Why is the route not working?

Route::get('/system/settings/roles/add', function () {
        return view('system.settings.roles.create');
    })->name('system.settings.roles.add');

However, other routes work, but this one always shows 404.

Full code:
Show

<?php

use Illuminate\Support\Facades\Route;

Route::group(['middleware' => 'auth'], function () {
    Route::get('/', 'App\Http\Controllers\Index\IndexController')->name('index');

    Route::get('/system/settings/roles', 'App\Http\Controllers\System\Settings\Roles\[email protected]')->name('system.settings.roles');
    Route::get('/system/settings/roles/{id}', 'App\Http\Controllers\System\Settings\Roles\Roles[email protected]')->name('system.settings.roles.show');
    Route::get('/system/settings/roles/add', function () {
        return view('system.settings.roles.create');
    })->name('system.settings.roles.add');
});

Route::group(['middleware' => 'auth'], function () {
    Route::patch('/system/settings/roles/{id}/update', 'App\Http\Controllers\System\Settings\Roles\[email protected]')->name('system.settings.roles.update');
    Route::post('/system/settings/roles/create', 'App\Http\Controllers\System\Settings\Roles\[email protected]')->name('system.settings.roles.create');
});


Route::group(['middleware' => 'web'], function () {
    Route::get('/login', function () {
        return view('auth.login');
    })->name('login');
});

Route::group(['middleware' => 'web'], function () {
    Route::post('/login', 'App\Http\Controllers\Auth\LoginController');
});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question