anlutro / laravel-controller by anlutro

Base Laravel controller classes.
1,178
5
2
Package Data
Maintainer Username: anlutro
Maintainer Contact: anlutro@gmail.com (Andreas Lutro)
Package Create Date: 2014-01-13
Package Last Update: 2015-09-03
Language: PHP
License: MIT
Last Refreshed: 2024-05-12 03:10:09
Package Statistics
Total Downloads: 1,178
Monthly Downloads: 2
Daily Downloads: 0
Total Stars: 5
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Laravel 4 Controller Build Status Latest Version

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.