Supported features:
- Compound primary keys for models
- RelationController Extender
- It extends the Backend\Behaviors\RelationController
- It fixes the problem with the scope and condition query for relation list
See the Documentation tab for integrating the extensions.
Composite Key in Model
Step 1: just add the trait "\Cyd293\Extenders\Database\Traits\CompositeKey" to your model
Step 2: make your primaryKey in array of composite Keys
Step 3: add another properties $compositeKey this must be the name of composite key
Step 4: add to appends the name that you have inputed in $compositeKey
Example:
Model File
class YourModel extends Model {
use \Cyd293\Extenders\Database\Traits\CompositeKey;
protected $compositeKey = 'mycomposite';
protected $appends = ['mycomposite'];
public $primaryKey = [
'key1','key2','key3'
];
}
Note: to get the composite key value of the model just use the value of the model property $compositeKey Example:
fields:
mycomposite:
label: My Composite Key
type: text
For the RelationBehavior
Step 1: Instead of using "Backend.Behaviors.RelationController" to implement in Controller, use "Cyd293\Extenders\Behaviors\RelationController"
Step 2: add this "\Cyd293\Extenders\Traits\RelationTrait" trait in your controller
Example:
class Permission extends Controller
{
use \Cyd293\Extenders\Traits\RelationTrait;
public $implement = [
'Backend\Behaviors\ListController',
'Backend\Behaviors\FormController',
'Cyd293.Extenders.Behaviors.RelationController'
];
public $listConfig = 'config_list.yaml';
public $formConfig = 'config_form.yaml';
public $relationConfig = 'config_relation.yaml';
}
-
This plugin has not been reviewed yet.
-
| 1.0.1 |
Initialize plugin. May 17, 2016 |
|---|