定制 perrotin/smart-select 二次开发

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

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

perrotin/smart-select

最新稳定版本:0.1.1

Composer 安装命令:

composer require perrotin/smart-select

包简介

A tool that will allow you set default select to your model and create the database user with the limited grants.

README 文档

README

Install

Install the package

composer require perrotin/smart-select

followed by

php artisan vendor:publish --provider="SmartSelect\Providers\SmartSelectServiceProvider"

for developement

If you wish to update the package, a good way is to update the repository and replace it with

"repositories": [
    {
        "type": "path",
        "url": "./packages-folder/smartselect",
        "options": {
            "symlink": true
        }
    }
],

How to use

Set up the package

In every model you want, you must :

  • use the HasDefaultSelect trait
  • use the HasDefaultSelectColumns interface
  • set the getGrantColumns()method.

For example

namespace App\Models;

use SmartSelect\Contracts\HasDefaultSelectColumns;
use SmartSelect\Traits\HasDefaultSelect;

class User extends Model implements HasDefaultSelectColumns
{

	use HasDefaultSelect;

	protected $table = 'users';

	public function getGrantColumns(): array
    {
        return [
			'select' => ['id','name','created_at','updated_at'],
            'insert' => ['email', 'name'] // $this->fillable
		];
    }
}

Configure it

use commands

TODO

  • Testing
  • Config option to execute grant access depending of environment
  • ...

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-20