adamibrahim/superauth

Laravel 5.6 Authentication Package

v0.2.7 2019-02-02 11:33 UTC

README

Laravel 5.6 Superauth

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

  • Laravel 5.6 Authentication package with
  • Multi user type with roles (superadmin, admin, editor, user and featured user)
  • User redirect to proper page (profile / admin dashboard)
  • Registered user email confirmation using trait (Traits\AuthRedirect)
  • User roles sync (include test views url /admin/test, /test/profile )
  • Using Laravel Queue Jobs
  • Customizable Markdown template for notifications (Confirm Email and Reset password)
  • User soft delete (active/inactive)
  • Auth roles editing method for testing at profile and dashboard
  • All content, message and alerts are localized, languages files in two languages (English, Russian), to insert language switcher please visit my localization easy package adamibrahim/localization

Demo

You can see working demo

Login / Profile / Dashboard Routes

- /login (user --not moderator-- login )
- /test/profile (user --not moderator-- profile )
- /admin/login (Moderator login)
- /admin/test (Moderator dashboard)

Install

$ composer require adamibrahim/superauth
If you are installing at laravel 5.5 or higher then you may go directly to Publish other wise you will need to edit composer.json, register the Service Provider and the middleware
composer.json

Add this code to your composer.json under the autoload at your main directory

"psr-4": {
            "Adam\\Superauth\\": "vendor/adamibrahim/superauth/src"
        }
Service Provider

At file config/app.php register service provider under * Package Service Providers...

Adam\Superauth\SuperauthServiceProvider::class,
Middleware

if you are using Laravel version lower than 5.5 then you need to register the moderators and Visitor middleware at your App\Http\Kernel.php

  • At protected $routeMiddleware = [ ] array add the below code
'moderators' => \Adam\Superauth\Middleware\Moderators::class,
'visitor' => \Adam\Superauth\Middleware\Visitor::class,
Publishing
This will overwrite your User.php model
$ php artisan vendor:publish --tag=Superauth --force
Database Migrating

run the Artisan migration command

$ php artisan migrate

Seeding

Run the Artisan Seeding command

$ php artisan db:seed --class=Adam\Superauth\database\seeds\RolesTableSeeder

Artisan Seed Error

If you receive Class not found Error:

ReflectionException : Class Adam\Superauth\database\seeds\RolesTableSeeder does not exist

Then you may need to dump-autoload by running this command

$ composer dump-autoload

Then run the seeding command once again

$ php artisan db:seed --class=Adam\Superauth\database\seeds\RolesTableSeeder
Job Queues

I'm Using Queues to send emails (speed up the app) however if you don't wish to use it you can change at your .env file

QUEUE_DRIVER=sync

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email :author_email instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.