Laravel 8 was released on September 8th along with Laravel Jetstream.
Laravel Jetstream is a new application scaffolding for Laravel. Laravel Jetstream replaces the legacy Laravel authentication UI available for previous Laravel versions.
In this tutorial, I will give you a quick introduction to what exactly Laravel Jetstream is and how to get started with it.
What is Laravel Jetstream
Jetstream gives you a better starting point for your new projects. It includes the following components:
Laravel Jetstream replaces the legacy Laravel authentication UI available for previous Laravel versions.
Jetstream uses Tailwind CSS, and you can choose between Livewire or Inertia.
Laravel Jetstream is free and opensource.
Installing Laravel Jetstream
You can choose between a couple of ways of installing Laravel Jetstream. You could either use composer or the Laravel installer.
Installing Jetstream with Laravel installer
If you already have the latest version of the Laravel installer, you just need to use the --jet flag in order to install a new Laravel Jetstream project:
After that, as usual, make sure to run your migrations:
Installing Jetstream with Composer
If you prefer using composer, you need to run the following command inside your Laravel directory just like you would with any other package:
"Note: you need to have Larave 8 installed. Otherwise, the above command will fail."
After that, you would need to run artisan jetstream:install and specify the stack that you want to use:
If want to use Livewire with Blade run:
And if you want to use Inertia with Vue run:
You may also add the --teams flag to enable Laravel Jetstream team support.
After that, execute:
The command above will build your assets.
Finally, make sure to run your migrations:
Your new Jetstream application comes out of the box with:
You can find those views at:
The backend logic is powered by Laravel Fortify.
You can find the Fortify actions at the following directory:
And you can find the Fortify configuration at:
In the fortify.php config file, you can make some changes like enable and disable different features like:
Right out of the box, Jetstream provides you and your users with user profile management functionality which allows users to update their name, email address, and their profile photo.
The user profile view is stored at:
And in case you are using Inertia, the view can be found at:
The following file handles the user update logic:
In case that you want to, you could also disable the user profile picture via your Jetstream config file at:
Just comment out the Features::profilePhotos() line:
Laravel Jetstream comes with the standard functionality that allows users to update their password and log out:
However, what's more, impressive is that Jetstream also offers two-factor authentication with QR code, which the users could enable and disable directly:
Another brilliant security feature is that users can logout other browser sessions as well.
The profile Blade views can be found at:
And the if you are using Inertia, you can find them at:
Laravel Jetstream uses Laravel Sanctum to provide simple token-based API.
With Sanctum, each user can generate API tokens with specific permissions like Create, Read, Update, and Delete
Then to check the incoming requests, you can use the tokenCan method like this:
Again you can disable API support in your config/jetstream.php config file.
If you used the --team flag during your Jetstream installation, your website would support team creation and management.
With the Jetstream teams feature, each user can create and belong to multiple different teams.
For more information about Jetstream teams, you can take a look a the official documentation here.
Laravel Jetstream gives you a great head start when starting a new project!
Are you looking for PHP Laravel Developers? Hire from us: https://infynno.com/hire-laravel-developers