tyler36 / isadmin
A simple way to define an administator, with a auth.admin middleware
Requires
- illuminate/support: ~5|~6|~7
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- mockery/mockery: ^1.1
- orchestra/testbench: ~3|~4
- phpunit/phpunit: ^8.0
- sempro/phpunit-pretty-print: ^1.0
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-11-13 00:24:22 UTC
README
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
- Register the middleware in the
app/Http/Kernel.php
. You can change the middleware short name by replacingauth.admin
.
protected $routeMiddleware = [ ... 'auth.admin' => \tyler36\isAdmin\isAdminMiddleware::class, ... ];
Usage: Trait
- Add the trait to your user model
class User extends Authenticatable { use Tyler36\isAdmin\isAdminTrait; ....
- 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.