-
Notifications
You must be signed in to change notification settings - Fork 0
/
Help
92 lines (61 loc) · 3.2 KB
/
Help
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
BACK END SETTINGS HELP
User settings can be made in the settings method of the child controller (controller that extends the base class). If settings method does not exists in the child class, you can create it manually like any other function. The settings will be loaded automatically.
To override a setting, add the required setter to the child settings method, like below:
public function setting()
{
$this->base->setModel(App\Model::class);
return;
}
For permissions to work, the user model must have a "hasPermission" method, that would be used to check permission. This could be by manually creating a method or using supported permission management packages.
/**
* Basic settings
*/
current model
(make sure it is set with the "::class" added)
$this->base->setModel(string 'App\Directory\Name(Model)::class');
Current model's name
Automatically gotten from the route's uri (e.g. user will be gotten from the uri 'localhost/user/methodUri [show, edit, delete, etc]')
$this->base->setName(string 'Model');
Current model's plural name
Automatically set using name
$this->base->setPluralName(string 'Models');
Related models that should be fetched along with the model for display.
There is none as default
$this->base->setRelated(array (['App\Directory\Name(User)::class', 'App\Directory\Name(Model)::class']));
Name of folder where view files are located
Default is the plural name of the model
$this->setViewsFolder('models');
/**
* This are controller methods
* Override and add your to the list
* This are the available settings.
* Simply create a "setting" method in your controller and call any of the functions below
* set general defaults here and other setting in your controller
*
*/
Methods that requires storing data [update, store]
Override and add yours to the list
$this->setStorageMethods(array (['update', 'store']));
Methods that deletes data ['delete', 'forceDelete']
$this->setDeleteMethods(array ([]));
All your supported controller methods ['index', 'create', 'update', 'store', 'show', 'delete', 'forceDelete']
$this->setAllMethods(array ([]));
Methods that requires single models for display ['show', 'edit']
$this->setSingleMethods(array ([]));
Methods that requires multiple models for display ['index']
$this->setMultipleMethods(array ([]));
Methods that requires models for display []
$this->setRequiresModel(array ([]));
Methods that allowed for the model
$this->setAllowedMethods(array ([]));
Methods that are not allowed (Will be rejected)
$this->setNotAllowedMethods(array ([]));
$this->base->setModel(Model::class); // current model (could also use 'App\Model' as a string)
$this->base->setName('Model'); // model name
$this->base->setPluralName('Models'); // plural name
$this->base->setRelated([Hello::class, Help::class]); // related models (could also use 'App\Hello' as a string)
/**
* Validation
*/
Form validation class
$this->setValidator(string 'App\Directory\Name(validator)::class');