Hello Guys,
In this example, we will discuss about Laravel 8 Authentication with Jetstream. In this post will give you simple and easy example of laravel 8 authentication using jetstream example. you can see Laravel 8 Jetstream auth with Livewire.
It's very amazing features in Laravel 8. Laravel 8 has totally changed with the authentication scaffolding. Laravel Jetstream is a beautifully designed application scaffolding for Laravel. It provide many buit-in funcationality includes login, registration, email verification, two-factor authentication, session management, API support via Laravel Sanctum, and optional team management.
Laravel Jetstream is designed using Tailwind CSS with different choice of Livewire or Inertia. So in this example we will perform Laravel 8 Auth using Livewire.
Let's start and follow bellow steps and perform example of Laravel 8 Authentication with Jetstream Example.
We are creating new project setup for this example , So create new project using below command.
composer create-project --prefer-dist laravel/laravel blog
In this step, we need to use composer command to install jetstream, so let's run bellow command for install jetstream.
composer require laravel/jetstream
In this step we are creating authentication using bellow command. Jetsream provide two command for create authentication. simple login, register email verification and if you want to create team in your laravel project then also provide using team parameter in command.
Install livewire with or without team
php artisan jetstream:install livewire
OR
php artisan jetstream:install livewire --teams
In this step we are installing node package. Before installing the npm package, it will require the node.js in your system. If you haven’t installed in your system then do it before proceeding to this step.
npm install
Let's run node.js package
npm run dev
After run both command we need to add migration in our database so copy bellow command and paste in your terminal
php artisan migrate
Features of Laravel 8 Jetstream
Laravel 8 Jetstream provides new all feature are configurable. you can see there is a configuration file config\fortify.php and config\jetstream.php file where you can enable and disable option for that features and also provide other configuration file like sanctum.php, hashing.php etc.
config\fortify.php
...
'features' => [
Features::registration(),
Features::resetPasswords(),
Features::emailVerification(),
Features::updateProfileInformation(),
Features::updatePasswords(),
Features::twoFactorAuthentication([
'confirmPassword' => true,
]),
],
...
config\jetstream.php
...
'features' => [
Features::profilePhotos(),
Features::api(),
Features::teams(),
],
...
Please make sure if you are run with php artisan jetstream:install livewire --teams command then enable teams features or other features other wise you will get error.
Now run your application using bellow command
Now you will get output like below screenshot.
Home Page
Login Page
Profile Page