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
- 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,
...
];
- 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);
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.