
Good content takes time and effort to come up with.
Please consider supporting us by just disabling your AD BLOCKER and reloading this page again.
I was working on the project and had almost completed it, by then all the sudden my manager told to change the URL prefixes of a few modules of the project. I was searching for routes and replacing them manually. It was a pain in the ass to go and change in all the places.
Then I came across Laravel Named Routes and how it saved me and will save me in future from this kind of situation too.
Named routes allow you to generate URLs without being coupled to the actual URL defined on the route.
Route::get('/auth/login', [AuthController::class, 'login']);
Route::get('/auth/login', [AuthController::class, 'login'])->name('login');
Instead of
{{ url('/auth/login') }}
{{ route('/auth/login') }}
Route::post('/payments/payment-success/{event}', [PaymentController::class, 'store']);
Route::post('/payments/payment-success/{event}', [PaymentController::class, 'store'])->name('payment-success');
{{ url('payments/payment-success/' . $event->id) }}
{{ route('payments/payment-success', ['event' => $event->id]) }}
Route::get('/post/{post}/comment/{comment}', [PostController::class, 'show'])->name('comment.show');
{{ route('comment.show', ['post' => 1, 'comment' => 3]) }}
// http://example.com/post/1/comment/3
route('post.show', ['post' => 1, 'search' => 'rocket']);
// http://example.com/post/1?search=rocket
Generate Fake Data In PHP With Faker
Use Different PHP Versions In Ubuntu / Linux
Generate RSS Feeds in PHP Laravel
Factories To Speed Up Test-Driven Development In Laravel
What Is Composer? How Does It Work? Useful Composer Commands And Usage
Securely SSH Your Server & Push Files With FileZilla
Google, Twitter, GitHub, Facebook & Many Other Social Generic Logins With PHP Laravel Socialite
Foreign Key Migrations Simplified In Laravel 7.x
Generate Sitemap in PHP Laravel
Testing Laravel Emails With MailHog
Securely Connect Server MYSQL DB From Sequel Pro / MYSQL Workbench