The common Laravel template structure

First, create a file that defines the structure of your page layout.blade.php @include('includes.header') @yield('content') @include('includes.footer') Then create files that yield content index.blade.php @extends('common_template') @section('content') {{$data['title']}} @endsection

October 17, 2021 · 1 min · Saqib Razzaq

Laravel - create a user by default

Sure, we can user Laravel’s database seeding and $faker to create any number of fake users. Personally, I don’t like to waste time fetching a new random user and their email address to continue my testing. I like have the same user created each time database is seeded. I do it like this. Run below command to create a new seeder in database/seeds directory. php artisan make:seeder UserSeeder In run method of UserSeeder....

September 17, 2021 · 1 min · Saqib Razzaq

How to modify Laravel 'HOME' redirection path

When a user logs in, Laravel redirects it to path stored in HOME constant by default. If you want to modify this constant or add constants of your own, you can do it like this. Open app\Providers\RouteServiceProvider.php Search public const HOME to update HOME constant You can add your own just like that

August 19, 2021 · 1 min · Saqib Razzaq

Laravel - common template structure

First, create a file that defines the structure of your page layout.blade.php @include('includes.header') @yield('content') @include('includes.footer') Then create files that yield content index.blade.php @extends('common_template') @section('content') {{$data['title']}} @endsection

August 19, 2021 · 1 min · Saqib Razzaq

Bootstrap Auth Scaffholding in Laravel

If Laravel is not installed, first run composer create-project laravel/laravel composer require laravel/ui php artisan ui bootstrap --auth

March 17, 2021 · 1 min · Saqib Razzaq