How to use Laravel multiple guards

Mokhlas Hussein
May 26, 2019 · 2 min read
Image for post
Image for post
figure: 1.0 ( laravel 5 cover )

The story begins 2 years ago when i started using the Amazing Laravel Framework, and discovered the multiple guards system which made me really feel Wow now ( Users authentications are separated from the Admin authentications ). but there were one problem about it, that i need to create the hole guard requires myself ( views, middlewares, controllers, models and many other stuffs ) and after a while i decided to create my own Laravel app template which i clone each time which has ( Admin and User guards ) works together as expected and reduce the development time, But one day i received a project which needs other guard ( Teacher, Parent and Student ) now we don’t need Users anymore here, so now my own Laravel app template became a little useless because i will create the guards requires myself again from scratch, at this time i felt really bad about creating everything from scratch, but i came with an idea which changed the way i develop Laravel apps forever MultiAuthCommand when i started to develop this command i felt bad because it was a challenge to me which i really loved to work on it, after almost 1 and half now this command serve me a lot, it save me a lot of times as it’s flexible because recently i added a theme option to it which has prebuilt views for different Admin panels from the internet, and the use of this command is really simple.

  • How to install
composer require imokhles/multi-auth-command
  • Add this provider to your config/app.php ( no need for Laravel 5.5 and above )


  • list all supported themes
php artisan make:multi_auth:list_themes
  • how to create Admin guard + select one of supported themes
php artisan make:multi_auth Admin --admin_theme="startui"
  • copy theme files to
  • if needed change theme folder name under public ( inside config/[guard]_config.php )

THAT’s ALL check the github page to understand more about this package.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store