Back to Blog 2 min read

Explained Laravel Login Link Package By Spatie

Hi everyone, writing after a long time today. In this month's series, I'll be introducing a few time-saving packages in front of you so that you...

Gurpreet Kait

Gurpreet Kait

Author

Hi everyone, writing after a long time today.

In this month's series, I'll be introducing a few time-saving packages in front of you so that you guys can save your time while doing code. Well. As the name says Laravel-login-link package provides a simple and minimal implementation to devs as well as to people who are lazy like me.

Let me show you some examples of frontend what it does and why I am using this in my current project.

Do you see the login page?

If yes, you can see 4 roles that can log into the application right? Well, If you are developing features for CRM, Designer, or sometimes only for admin. Instead of typing creds again and again you can create a login link for admin and all the roles just by using the package laravel-login-link.

For me, it does make a lot of sense. Because I don't want to play with inputs each time.

Implementation

I had an ongoing project where I implemented this package. Because I wanted to make things easy. I'm gonna show you what I did.

Installed using composer require spatie/laravel-login-link

After installing the package I have implemented the component in my login.blade.php file.

                @env('local')
                <x-login-link email="admin@gmail.com" label="Login as Admin" />
                <x-login-link email="crm@gmail.com" label="Login as CRM" />
                <x-login-link email="designer@gmail.com" label="Login as Designer" />
                <x-login-link email="acc@gmail.com" label="Login as Account Executive" />
                @endenv

Note: I am using password " password " for each role. It worked without any conflict.

More Info

If you are curious about Laravel then perhaps you know Povilas Korop and he created a video about this package that gives some more info about the package you can watch it on YouTube.

https://www.youtube.com/watch?v=TN0NKHVeWGc