mrlaozhou / laravel-indulge
There is no license information available for the latest version (v1.7) of this package.
Laravel database field extension
v1.7
2018-12-16 10:15 UTC
Requires
- php: >= 7.0
- mrlaozhou/laravel-extend: ^1.1
Requires (Dev)
- laravel/framework: 5.6.*
- phpunit/phpunit: ~7.3
README
Install
To install through Composer, by run the following command:
composer require "mrlaozhou/laravel-indulge"
The package will automatically register a service provider and alias.
Optionally, publish the package's configuration file by running:
php artisan vendor:publish --provider="Mrlaozhou\Indulge\LaravelIndulgeServiceProvider"
php artisan indulge:migrate
Document
Config
You can modify the provider at will.
Filepath: config/indulge.php
return [ 'providers' => [ /** * * Indulge option provider */ 'option' => \Mrlaozhou\Indulge\Entities\Option::class, /** * * Indulge field provider */ 'field' => \Mrlaozhou\Indulge\Entities\Field::class, /** * * Indulge value provider */ 'value' => \Mrlaozhou\Indulge\Entities\Value::class ], ];
Using
Model
Use trait "\mrlaozhou\laravel-indulge\Indulge" in you (Eloquent)Model.
ep: Model: App\Models\Leads
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Mrlaozhou\Indulge\Indulge; class Leads extends Model { use Indulge; }
Seamless expansion .
Facade
IndulgeOption::trees($pid); // recursion
IndulgeOption::lists($pid); // recursion
IndulgeOption::roots(); // pid === 0
IndulgeOption::child($pid); // sub