Level 75
Route::view has to work with view directly without controller.
Route::view('dashboard-index', 'backend.dashboard.index')->name('dashboard-index');
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Folder structure:
app\Http\Controllers\Backend\Dashboard\PagesController.php
View Structure:
resources\views\backend\dashboard\index.blade.php
Route::namespace('Backend.Dashboard')->group(function () {
Route::view('dashboard-index', 'PagesController@index')->name('dashboard-index');
});
<?php
namespace App\Http\Controllers\Backend\Dashboard;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class PagesController extends Controller
{
/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index()
{
return "Hello world!";
}
}
Route::view has to work with view directly without controller.
Route::view('dashboard-index', 'backend.dashboard.index')->name('dashboard-index');
Please or to participate in this conversation.