Using a slug as the route key in Laravel
Use pretty URLs for your Laravel project by implementing slugs and avoid the integer id as the route key. The following 2 URL examples are for the route /location/{location} This…
PHP backend web language
Use pretty URLs for your Laravel project by implementing slugs and avoid the integer id as the route key. The following 2 URL examples are for the route /location/{location} This…
How to set a Laravel model’s default orderby column without modifying existing queries or implementing in new calls. This is done using the boot function which is used to override…
Apply an auth middleware to only certain routes in a Laravel resource route without needing to write out each route individually. Generally a CRUD resource route looks like this in…
How to make registered users verify their account email before using the Laravel application. With the baseline Laravel authentication framework Breeze when a user registration or sign-up occurs the user…
A guide on sending an email when a user registers on your Laravel application. This gives you a near-instant notification on registration activity. Whilst the user gets a welcome and…
Use a custom email template blade file for your Laravel password reset email with just 6 lines of code. Open app/Providers/AuthServiceProvider.php in the boot() function paste and edit the following:…
Use your own email template blade file for the user verification email in Laravel, instead of the default email layout. Sending a custom verification email is quite simple, all you…
How to run an event or function when a user verifies their account by using a Laravel listener. Start by creating a listener in Artisan php artisan make:listener SendVerifiedWelcomeMail You…
How to create and use a custom middleware in Laravel 9. A middleware means that any HTTP request for that route must pass through it, making it good for checking…
How to clear all of the different Laravel cache types using the Laravel Artisan console. Clearing the application cache The application cache or simply said as “cache” is the data…