Name routes your way
name
method to name our route.Route::get('/get-started', function() {
return "Get Started";
})->name('getting-started');
To name a resource route is not too different. We just need to override the names that we want to assign a name to.
use App\Http\Controllers\CameraController;
Route::resource('cameras', CameraController::class)->names([
'create' => 'cameras.form'
]);
parameters
method.use App\Http\Controllers\BestCameraController;
Route::resource('cameras', BestCameraController::class)->parameters([
'cameras' => 'best_camera'
]);
This generates the following route: /cameras/{best_camera}
.
You can now access the routes the exact same way as you’re used to with regular route names.
<div class="flex justify-center lg:justify-start mt-6">
<a class="px-4 py-3 bg-gray-900 text-gray-200 text-xs font-semibold rounded hover:bg-gray-800"
href="{{ route('cameras.form') }}">
Check out the camera form
</a>
</div>
Laravel Series
Continue your Laravel Learning.
Register only what you need with partial resource routes
Laravel – P59: Partial Resource Routes
In part 59 of our Laravel fundamentals series, discover how partial resource routes let you register only the endpoints you need. Learn the only and except options, group route patterns, and keep your routing file lean and secure.
Name routes your way
Laravel – P60: Resource Route Names
Part 60 of our Laravel fundamentals series unpacks how to customize resource route names for maximum clarity. Override default naming, prevent helper collisions, and keep large-scale projects organized with readable, intuitive route helpers and API endpoints.
Keep every Blade view in sync—share once, use everywhere
Laravel – P61: Sharing Data With All Views
In part 61 of our Laravel fundamentals series, learn techniques to share global data with every Blade view. Explore View::share, service-provider boot methods, view composers, and caching tips for consistent, performant layouts across your app.