Download the PHP package mvd81/laravel-is-admin without Composer
On this page you can find all versions of the php package mvd81/laravel-is-admin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mvd81/laravel-is-admin
More information about mvd81/laravel-is-admin
Files in mvd81/laravel-is-admin
Package laravel-is-admin
Short Description Laravel package, simple functionality to set a user as admin without an advanced role system
License MIT
Informations about the package laravel-is-admin
Laravel Is Admin
Introduction
Laravel package to extend your Laravel application with a simple admin permission functionality, with:
- Migration file to set a user as admin
- Middleware
- Blade directive
- Artisan command to see who is an admin
- Option to set user with ID 1 as super admin
Requirements
Laravel 8 or higher
Installation
-
Run
to create the 'is_admin' column in the table
-
Import the trait in the User model
- Use the trait in the user model
How to use
You can set a 'normal' user as admin by setting the database column to , in database table .
Or in the code
Make admin
Undo admin
Super admin
It is possible to use user with ID 1 as admin without setting the 'is_admin' column to 1.
First you need to publish the config file.
- Choose the option: Provider: Mvd81\LaravelIsAdmin\LaravelIsAdminServiceProvider
Now in set 'use_super_admin' to true.
Middleware
There is a middleware to use in your routes.
Example:
Blade directive
Partial template/layout in your Blade view files only for admins?
You can use this Blade directive
Who is an admin?
You can enter an artisan command to see how is an admin.
Uninstall
- Remove the config file
- Remove the database column in table
- If you used the blade directive, remove them
- Remove the middleware from your routes