perrotin / smart-select
A tool that will allow you set default select to your model and create the database user with the limited grants.
Installs: 664
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 1
pkg:composer/perrotin/smart-select
Requires
- php: ^8.0
- illuminate/console: ^8.0|^9.0|^10.0|^11.0|^12.0
- illuminate/database: ^8.0|^9.0|^10.0|^11.0|^12.0
- illuminate/filesystem: ^8.0|^9.0|^10.0|^11.0|^12.0
- illuminate/support: ^8.0|^9.0|^10.0|^11.0|^12.0
- symfony/yaml: ^6.0|^7.0
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^9.0
This package is not auto-updated.
Last update: 2026-01-12 22:00:13 UTC
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
- ...