anlutro / l4-controller
Base Laravel controller classes.
Installs: 1 184
Dependents: 3
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.4.0
- illuminate/routing: >=4.1, <6.0
- illuminate/support: >=4.1, <6.0
Requires (Dev)
- mockery/mockery: 0.9.*
README
Installation: composer require anlutro/l4-controller
Pick the latest stable version from packagist or the GitHub tag list.
WARNING: Backwards compatibility is not guaranteed during version 0.x.
Controller
protected function url($action, $params = array())
This is a shorthand for URL::action
with a twist - if no controller is given, it defaults to the current controller. For example, if you call url('index')
from MyController
, it will return URL::action('MyController@index')
.
protected function redirect($action, $params = array())
Same as above, but for redirects.
API Controller
Provides some standardized responses when there's no real data to return.
protected function success($messages = null)
Returns a generic 200 response with optional messages.
protected function error($errors)
Returns a generic 400 response with the errors given. Will work with validators, message bags and arrays.
protected function notFound($messages = null)
Returns a generic 404 response with optional messages.
Contact
Open an issue on GitHub if you have any problems or suggestions.
License
The contents of this repository is released under the MIT license.