定制 yeswedev/laravel-modo 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

yeswedev/laravel-modo

Composer 安装命令:

composer require yeswedev/laravel-modo

包简介

YWD Laravel Nova Field Moderation

README 文档

README

A simple Moderation.

This package allows you to approve or reject resources for each fields you configure

screenshot

Installation

Install this package in your Laravel app via composer:

composer require yeswedev/laravel-modo

You need to add this to your config/app.php providers array


'providers' => [
    ...
    YesWeDev\LaravelModo\LaravelModoServiceProvider::class,

];

Publish the config file

php artisan vendor:publish --tag=laravel-modo

And finaly migrate the moderations table into your database

php artisan migrate

or

php artisan migrate --path=vendor/yeswedev/laravel-modo/database/migrations

Preparation

First you need to prepare your model with the Moderate trait


use YesWeDev\LaravelModo\Traits\Moderate;

class YourModel extends Model
{
    use Moderate;
    ...
}

You need to add the second trait HasRoleModerated to your User model


use YesWeDev\LaravelModo\Traits\HasRoleModerated;

class User extends Model
{
    use HasRoleModerated;
    ...
}

Now you are ready to use it !

Usage

In your model add two array $rolesModeration and $fieldsModeration

The $rolesModeration array must contain your desired user role which can be moderated by your admin

The $fieldsModeration contains the fields which can be moderated by your admin


use YesWeDev\LaravelModo\Traits\Moderate;

class YourModel extends Model
{
    use Moderate;
    
    protected $rolesModeration = [
        'moderator'
    ];

    protected $fieldsModeration = [
        'title' => 'title',
        'description' => 'description',
    ];
}

You can set your user role which can moderate in config/laravel-modo, default is admin


/*
|--------------------------------------------------------------------------
| Moderator Role
|--------------------------------------------------------------------------
|
| Define the role which can moderate.
|
*/
'moderation_role' => 'admin',
...

License

The BSD 2 Clause License (BSD 2).

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-2-Clause
  • 更新时间: 2018-10-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固