mathewparet/laravel-policy-abilities-export 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mathewparet/laravel-policy-abilities-export

最新稳定版本:v2.0.1

Composer 安装命令:

composer require mathewparet/laravel-policy-abilities-export

包简介

Export Laravel Policy abilities to JSON for use with VueJS front end

README 文档

README

This package exports all laravel policy defined abilities as a JSON object for VueJS to process.

Installation

Require the module:

composer require mathewparet/laravel-policy-abilities-export

Add the ExportsPermissions trait to your model

use mathewparet\LaravelPolicyAbilitiesExport\Traits\ExportsPermissions;
// ...
class Blog extends Model
{
    use ExportsPermissions;
}

Usage

The model will now have a can attribute that lists all abilities for that record.

For global abilities that are tied to the model but not the record itself (E.g., Blog Create), call Model::globalAbilities()

To create a resource collection that would export global abilities along with it, run:

php artisan make:resource-collection [--model=MODEL] name

统计信息

  • 总下载量: 739
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-07