LaravelPackages.net
Acme Inc.
Toggle sidebar
tyler36/isadmin

A simple way to define an administator, with a auth.admin middleware

42
0
0.2
About tyler36/isadmin

tyler36/isadmin is a Laravel package for a simple way to define an administator, with a auth.admin middleware. It currently has 0 GitHub stars and 42 downloads on Packagist (latest version 0.2). Install it with composer require tyler36/isadmin. Discover more Laravel packages by tyler36 or browse all Laravel packages to compare alternatives.

Last updated

isAdmin

Latest Version on Packagist Total Downloads Build Status StyleCI

This is where your description should go. Take a look at contributing.md to see a to do list.

Installation

Via Composer

$ composer require tyler36/isadmin

Update your .ENV file to include the administators email. Use a comma-separated string if there are multuple accounts.

AUTH_ADMINS_ADMINISTRATORS=admin@example.com

The default configuration might not be suitable for everyone. To change it, publish the configuration using the following command.

$ php artiasn vendor:publish --provider=Tyler36\isAdmin\isAdminServiceProvider

Usage: Middleware

  1. Register the middleware in the app/Http/Kernel.php. You can change the middleware short name by replacing auth.admin.
    protected $routeMiddleware = [
        ...
        'auth.admin'    => \tyler36\isAdmin\isAdminMiddleware::class,
        ...
    ];

Usage: Trait

  1. Add the trait to your user model
class User extends Authenticatable
{
    use Tyler36\isAdmin\isAdminTrait;
    ....
  1. You can know verify users on a model
$user = new User();

// Check if user is an admin
$user->isAdmin();

// Check if user is verified
$user->isVerified();

// Check if another user model ($someone) is an admin
$user->isAdmin($someone);

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

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

Credits

License

license. Please see the license file for more information.

Comments