Laravel 5.0 Documentation
App\Providers\RouteServiceProvider class. The most basic Laravel routes simply accept a URI and a Closure : Route::get('/', function() { return 'Hello World'; }); Route::post('foo/bar', function() database, a 404 error will be thrown. If you wish to specify your own "not found" behavior, pass a Closure as the third argument to the model method: Route::model('user', 'User', function() { throw }); If you wish to use your own resolution logic, you should use the Router::bind method. The Closure you pass to the bind method will receive the value of the URI segment, and should return an instance0 码力 | 242 页 | 1.44 MB | 1 年前3
Laravel 3.2 Documentation Allow the specification of a separate asset base URL for using CDNs. Allow a starter Closure to be defined in bundles.php to be run on Bundle::start. Allow the registration of custom database each time the "home" view is created, an instance of the View will be passed to the registered Closure, allowing you to prepare the view however you wish. Register a composer that handles multiple views: value if the requested input item doesn't exist: $name = Input::get('name', 'Fred'); Using a Closure to return a default value: $name = Input::get('name', function() {return 'Fred';}); Determining0 码力 | 139 页 | 1.13 MB | 1 年前3
Learning LaravelLayout Inheritance 22 Sharing data to all views 24 Using View::share 24 Using View::composer 24 Closure-based composer 24 Class-based composer 24 Execute arbitrary PHP code 25 Chapter 6: Cashier 26 simple API for managing user authorizations by using Gates and Policies. Gates provide a simple closure based approach to authorisation using the AuthServiceProvider while Policies allow you to organise logic into a single location. You can directly bind variable to a specific view or to all views. Closure-based composer use Illuminate\Support\Facades\View; // ... View::composer('*', function ($view)0 码力 | 216 页 | 1.58 MB | 1 年前3
Laravel 5.1 中文文档App\Http\Middleware; use Closure; class RoleMiddleware { /** * 运行请求过滤器. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @param string string $role * @return mixed */ public function handle($request, Closure $next, $role) { if (! $request->user()->hasRole($role)) { // 跳转... } App\Http\Middleware; use Closure; class OldMiddleware { /** * 返回请求过滤器 * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed0 码力 | 307 页 | 3.46 MB | 1 年前3
Laravel 5.2 中文文档本文档由 Laravel 学院(LaravelAcademy.org)提供 Laravel 学院致力于提供优质 Laravel 中文学习资源 11 * @param \Closure|string|null $concrete * @param bool $shared * @return void */ public function bind($abstract App\Http\Middleware; use Closure; class OldMiddleware { /** * 返回请求过滤器 * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed mixed */ public function handle($request, Closure $next) { if ($request->input('age') <= 200) { 本文档由 Laravel 学院(LaravelAcademy.org)提供 Laravel 学院致力于提供优质 Laravel 中文学习资源0 码力 | 377 页 | 4.56 MB | 1 年前3
Laravel 5.3 中文文档框架从未打算具有如此明显的特性。在 Laravel 5.3 中,你在控制器构造函数中不再能够直接获取 到 session 变量或认证后的用户实例,因为中间件还未启动。 仍然有替代方案,那就是在控制器构造函数中使用 Closure 来直接定义中间件。请注意,在使用 这个方案的时候,确保你所使用的 Laravel 版本高于 5.3.4: Closure|string|null $concrete * @param bool $shared * @return void */ public function bind($abstract Laravel 中文学习资源 111 use Closure; class CheckAge { /** * 返回请求过滤器 * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed0 码力 | 691 页 | 9.37 MB | 1 年前3
CakePHP Cookbook Documentation 5.xin CakePHP 4.x. DateType::setLocaleFormat() no longer accepts an array. Query now accepts only \Closure parameters instead of callable. Callables can be converted to closures using the new first-class declared with a space after the function keyword, and a space before and after the use keyword: $closure = function ($arg1, $arg2) use ($var1, $var2) { // code }; Method Chaining Method chaining checks. validationFailureCallback Callback to call in case of validation failure. Must be a valid Closure. Unset by default in which case exception is thrown on validation failure. Disabling form tampering0 码力 | 1080 页 | 939.39 KB | 1 年前3
CakePHP Cookbook Documentation 5.xCakePHP 4.x. • DateType::setLocaleFormat() no longer accepts an array. • Query now accepts only \Closure parameters instead of callable. Callables can be converted to closures using the new first-class declared with a space after the function keyword, and a space before and after the use keyword: $closure = function ($arg1, $arg2) use ($var1, $var2) { // code }; Method Chaining Method chaining should checks. validationFailureCallback Callback to call in case of validation failure. Must be a valid Closure. Unset by default in which case exception is thrown on validation failure. 198 Chapter 10. Controllers0 码力 | 848 页 | 2.53 MB | 1 年前3
CakePHP Cookbook 4.x
be attached to a query using Query::with(). Query::orderAsc() and Query::orderDesc() now accept Closure’s as their field enabling you to use build complex order expressions with the provided QueryExpression middlewares, i.e. classes with __invoke($request, $response, $next) method are deprecated. Instead use Closure with signature function($request, $handler) or classes which implement Psr\Http\Server\MiddlewareInterface deprecated. Instead use the className option. Datasource FactoryLocator::add() no longer accepts closure factory functions. Instead you must pass an instance of the LocatorInterface. Cake\Datasource\Paging\Paginator0 码力 | 1249 页 | 1.04 MB | 1 年前3
CakePHP Cookbook 4.x
attached to a query using Query::with(). • Query::orderAsc() and Query::orderDesc() now accept Closure’s as their field enabling you to use build complex order expressions with the provided QueryExpression middlewares, i.e. classes with __invoke($request, $response, $next) method are dep- recated. Instead use Closure with signature function($request, $handler) or classes which implement Psr\Http\Server\MiddlewareInterface deprecated. Instead use the className option. Datasource • FactoryLocator::add() no longer accepts closure factory functions. Instead you must pass an instance of the LocatorInterface. • Cake\Datasource\Paging\Paginator0 码力 | 967 页 | 2.88 MB | 1 年前3
共 27 条
- 1
- 2
- 3













