Download the PHP package webtack/generic-controller without Composer
On this page you can find all versions of the php package webtack/generic-controller. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webtack/generic-controller
More information about webtack/generic-controller
Files in webtack/generic-controller
Package generic-controller
Short Description Generic Controllers includes a set of generic representations that are ideally suited for solving a number of routine tasks.
License MIT
Homepage https://github.com/webtack/generic-controller
Informations about the package generic-controller
Generic Controllers
Generic Controllers is a extension system for your Laravel application.
Generic Controllers includes a set of generic representations that are ideally suited for solving a number of routine tasks.
Installation
Install using composer:
Simple examples
Use Generic as the parent classes. You can specify these classes as the parent for your custom view class and override the attribute values in the body of your class
TemplateController
Suitable for displaying static pages that do not receive data from the database.
Create a router and call the method in it @asView
DetailController
It should be used when you want to get one model for a given key
Create a router and call the method in it @asView
Context data
The method responsible for obtaining data from the database.
By default, there will be an attempt to get the model by the parameter id from the route
But you can override this behavior by overloading this method. It must return an array with a context name key and an object of the model.
Or override get method
Supported methods correspond to request types.
All methods accept the first object \Illuminate\Http\Request $request The following parameters can be those that you defined in your routes.
View Name
By default, DetailController will search for a view with the name of the "article-page" class new, and you will also be able to override it in the templateName method
Note the auxiliary methods templatePrefix and templateSuffix.
If you define them, the data will be appended to the name of the view returned by the method templateName
Context name
The name of the access variable in the view will be taken from the name of the model class starting with a small letter.
Of course you can override this in method contextObjectName
ListController
Use to display the list of entities
Create a router and call the method in it @asView
By default, the name of the view will be appended with the suffix - list, but you can undo or override this behavior in the corresponding method, of course.
P.S.
This is a small set of possibilities. But I think in the future I will expand it if necessary.