A simple way to define an administator, with a auth.admin middleware
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
This is where your description should go. Take a look at contributing.md to see a to do list.
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
app/Http/Kernel.php. You can change the middleware short name by replacing auth.admin. protected $routeMiddleware = [
...
'auth.admin' => \tyler36\isAdmin\isAdminMiddleware::class,
...
];
class User extends Authenticatable
{
use Tyler36\isAdmin\isAdminTrait;
....
$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);
Please see the changelog for more information on what has changed recently.
$ composer test
Please see contributing.md for details and a todolist.
If you discover any security related issues, please email author email instead of using the issue tracker.
license. Please see the license file for more information.