dainsys/locky
Composer 安装命令:
composer require dainsys/locky
包简介
A laravel UI wrapper for spatie/laravel-permission with Bootstrap 4!
README 文档
README
A laravel UI wrapper for spatie/laravel-permission with Bootstrap 4!
Installation
- Install with
composerby runining the commandcomposer require dainsys/locky - Add the
Dainsys\Locky\WithLockyAcl;to yourUsermodel(s);
use Illuminate\Foundation\Auth\User as Authenticatable; use Dainsys\Locky\WithLockyAcl; class User extends Authenticatable { use WithLockyAcl; }
- Add the following item to the
protected $castsarray:protected $casts = [ 'inactivated_at' => 'date' ];
- Set you
LOCKY_SUPER_USER_EMAIL=super.user@email-example.comin the .env file. - This package relies on you having an auth system. We strongly suggest using
laravel/jetstream,laravel/freezeor the legacylaravel/ui - Views:
- The package ships with it's own views, therefore you MUST publish the package public assets by running
php artisan vendor:publish --tag=locky-public. However, this is not necessary if you are planning to use your views. In this case you can runphp artisan vendor:publish --tag=locky-viewsand make them extends your own layout view.
- Migrations:
- By default the packages migrations will run if you execute the
php artisan migratecommand. However, you can set thewith_migrationsoption to false and handle the migrations yourselve. To do this, first run thephp artisan vendor:publish --tag=locky-configcommand. - Add the following liks to the auth portion of your
layouts.applinks:
@include('locky::_nav-links')
- You could also publish the package migrations by running
php artisan vendor:publish --tag=locky-migrationsand tweak them to suit your needs.
Usage
- After installing this package, you can limit user access by creating Laravel Policies with
php artisan make:policycommand and add the checksreturn $user->hasAnyRole(["role1", "role2"])orreturn $user->hasAnyPermission(["permission1", "permission2"])and by updating the Controller's constructor method:
use App\YourModel; class MyController extends Controller { public function __construct() { $this->authorizeResource(YourModel::class, 'model'); } }
- Please read Larave Authorization's documentations at https://laravel.com/docs/7.x/authorization
- This package add the concept of actives or inactive users by adding query scopes. Just use the scope
actives()orinactives()to filter as desired. - You can activate an user by calling the
activate()method on a Eloquent User record; useinactivate()to inactivate an user.
Dependencies
- Dainsys Components: https://packagist.org/packages/dainsys/components
- Laravel Ui: https://laravel.com/docs/7.x/authorization
- Spatie Permission: https://docs.spatie.be/laravel-permission/v3/introduction/
dainsys/locky 适用场景与选型建议
dainsys/locky 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 58 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 07 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 dainsys/locky 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dainsys/locky 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 58
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-07-01