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
HasDefaultSelecttrait - use the
HasDefaultSelectColumnsinterface - 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
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-20