Laravel 9 Auth using Jetstream Tutorial Example

Laravel 9

Nicesnippets

16-05-2022


Laravel 9 Auth using Jetstream Tutorial Example

Hi Dev,

In this tutorial, I will show you laravel 9 authentication using jetstream. In this blog, I will give you a simple example of laravel 9 auth with jetstream. you can see jetstream with auth in laravel 9 application. I would like to share with you the laravel 9 jetstream auth with inertia.

A few days ago laravel 9 was released and they provide lots of new updates. laravel 9 was using laravel/ui for auth scaffolding and now laravel 9 provides jetstream for login, registration, email verification, two-factor authentication, session management, API support, and team management.

Laravel 9 was designed by Tailwind CSS and they provide auth using livewire and Inertia. I will show you how to add auth in laravel 9. you can easily create laravel auth with jetstream step by step.

Here I will give a full example for jetstream with auth in laravel 9, So let's follow below step by step.

Download Laravel


Let us begin the tutorial by installing a new laravel application. if you have already created the project, then skip following step.

composer create-project laravel/laravel example-app

Auth Scaffolding using Livewire Jetstream

Laravel Livewire is a library that makes it simple to build modern, reactive, dynamic interfaces using Laravel Blade, Laravel controller, and Laravel validation.

Livewire provides a way to write your ajax with laravel blade, validation, and all, you can use it as a javascript framework. so let's see below step to create auth using laravel 9 livewire.

Install Jetstream:

Now, you can install jetstream using bellow command so lets open terminal and run bellow command:

composer require laravel/jetstream

Create Auth with Livewire:

Now we need to create authentication using below command you can create basic login, register, and email verification. if you want to create team management then you have to pass the additionl parameter. you can see the below commands:

php artisan jetstream:install livewire

OR

php artisan jetstream:install livewire --teams

Now, let's node js package:

npm install

let's run package:

npm run dev

Now, we have to need migration so let's bellow artisan command to migrate database:

php artisan migrate

Now, you can run and check. they installed all views, actions, and all in your laravel 9 application.

Auth Scaffolding using Inertia Jetstream

Laravel Inertia is a templating language and Inertia is working with vue js.

Install Jetstream:

Now, you can install jetstream using bellow command so lets open terminal and run bellow command:

composer require laravel/jetstream

Create Auth with Inertia:

Now we need to create authentication using below command you can create basic login, register, and email verification. if you want to create team management then you have to pass the addition parameter. you can see the below commands:

php artisan jetstream:install inertia

OR

php artisan jetstream:install inertia --teams

Now, let's node js package:

npm install

let's run package:

npm run dev

Now, we have to need migration so let's bellow artisan command to migrate database:

php artisan migrate

Now, you can run and check. they installed all views, actions, and all in your laravel 9 application.

Jetstream Features

Laravel 9 jetstream provides lots of features. you can see all features in the configuration file fortify.php and jetstream.php file where you can enable and disable options for that feature:

config/fortify.php

....

'features' => [

Features::registration(),

Features::resetPasswords(),

Features::emailVerification(),

Features::updateProfileInformation(),

Features::updatePasswords(),

Features::twoFactorAuthentication(),

],

...

config/jetstream.php

....

'features' => [

Features::profilePhotos(),

Features::api(),

Features::teams(),

],

...

Run Laravel App:

All steps have been done, now you have to type the given command and hit enter to run the laravel app:

php artisan serve

You will see layout as like bellow:

Output :

Home Page

Register Page

Login Page

Dashboard Page

Profile Page

Forgot Password Page

Create Team Page

Team Setting Page

It will help you...