Laravel 5.0 Documentation
Model Binding viii. Throwing 404 Errors ii. Middleware i. Introduction ii. Defining Middleware iii. Registering Middleware iv. Terminable Middleware Table of Contents iii. Controllers i. Introduction Introduction ii. Basic Controllers iii. Controller Middleware iv. Implicit Controllers v. RESTful Resource Controllers vi. Dependency Injection & Controllers vii. Route Caching iv. Requests i. Obtaining default namespace can be quickly changed using the new app:name Artisan command. Controllers, middleware, and requests (a new type of class in Laravel 5.0) are now grouped under the app/Http directory0 码力 | 242 页 | 1.44 MB | 1 年前3
Learning LaravelContribution Style Guide 2 About Laravel 2 Main Features 2 MVC 2 Blade Templating Engine 3 Routing & Middleware 3 Artisan 3 Eloquent ORM 3 Event Handling 3 Versions 3 Examples 4 Welcome to Laravel tag Syntax 28 Parameters 28 Remarks 28 Examples 28 Adding api-routes with other middleware and keep default web middleware 28 Chapter 8: Collections 30 Syntax 30 Remarks 30 Examples 30 Creating Collections 40 Chapter 11: Controllers 41 Introduction 41 Examples 41 Basic Controllers 41 Controller Middleware 41 Resource Controller 42 Example of how a Resource Controller look 42 Actions Handled By Resource0 码力 | 216 页 | 1.58 MB | 1 年前3
Laravel 5.6 中文文档本文档由 Laravel 学院提供 Laravel 学院致力于提供优质 Laravel 中文学习资源:http://laravelacademy.org 2 Route::middleware('auth:api', 'throttle:60,1')->group(function () { Route::get('/user', function () { 中,你可以基于认证用户模型属性指定一个动态的最大请求次数,如果 User 模型包含 rate_limit 属性,可以将属性名传递 给 throttle 中间件,以便用于计算最大请求次数计数: Route::middleware('auth:api', 'throttle:rate_limit,1')->group(function () { Route::get('/user', function () 201,如果应用的任意相应测试显式期望 200 状态码,那么需要将它们修改 为 201。 信任代理 由于信任代码功能使用的底层 Symfony HttpFoundation 有改动,所以必须微调 App\Http\Middleware\TrustProxies 中间件。 $headers 属性之前是个数组,现在是一个接收几个不同值的属性。例如,要信任所有转发头,需要像这样更新 $headers 属性: use I0 码力 | 377 页 | 14.56 MB | 1 年前3
Laravel 6.0 中文文档} 而在 Laravel 6.0 中,该业务逻辑可以被提取到任务中间件中,从而 将你的任务 handle 方法从频率限制中解放出来: Middleware; use Illuminate\Support\Facades\Redis; 本文档由学院君提供 学院君致力于提供优质 Laravel 中文学习资源:https://xueyuanjun 创建完中间件后,可以通过在任务类的 middleware 方法中返回中间 件数组来将其追加到队列任务中: use App\Jobs\Middleware\RateLimited; /** * Get the middleware the job should pass through. * * @return array */ public function middleware() { return Homestead 站点的请求重定向到 Homestead 虚拟机。在 Mac 和 Linux 系统中,该文件位于 /etc/hosts,在 Windows 系统中, 该文件位于 C:\Windows\System32\drivers\etc\hosts。我们 以 homestead.test 域名映射为例,添加到 hosts 文件的记录如下 所示: 192.168.10.10 homestead.test0 码力 | 1442 页 | 14.66 MB | 1 年前3
Laravel 5.1 中文文档的 action 之前验证被授予指定“角色”的认证用户,可以创建一个 RoleMiddleware 来接收角 色名称作为额外参数: Middleware; use Closure; class RoleMiddleware { /** * 运行请求过滤器. * * @param 指定,多个参数可以通过 逗号进行分隔: 本文档由 Laravel 学院(LaravelAcademy.org)提供 3 Route::put('post/{id}', ['middleware' => 'role:editor', functio n ($id) { // }]); 更多关于中间件的内容,请查看中间件一节。 测试革新 Laravel 中内置 特性已经被废弃并且会在 2015 年 12 月份的 Laravel 5.2 中被完全移除: 中间件中的路由过滤器 Illuminate\Contracts\Routing\Middleware,中间件中不再需要任何 contract, Illuminate\Contracts\Routing\TerminableMiddleware 被废弃,在中间件中定义一个 terminate0 码力 | 307 页 | 3.46 MB | 1 年前3
Laravel 5.2 中文文档route middleware groups. * * @var array */ protected $middlewareGroups = [ 'web' => [ \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQ ss, \Illuminate\Session\Middleware\StartSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, ], 'api' => [ 'throttle:60,1', ], ]; 然后,web 组像这样分配给路由: Route::group(['middleware' => ['web']], function () { // }); 访问频率限制 一个新的访问频率限制中间件已经被内置到框架中,从而允许你轻松限制给定 IP 地址在0 码力 | 377 页 | 4.56 MB | 1 年前3
Laravel 5.3 中文文档er}/status', function (Order $order) { // Access token has "check-status" scope... })->middleware('scope:check-status'); 最后,Passport 还支持从 JavaScript 应用访问你的 API,而不必担心访问令牌传输,Passport 通 过加密 JWT * * @return void */ public function __construct() { $this->middleware(function ($request, $next) { $this->projects = Auth::user()->projects; 中间件命名空间修改 罗列在 HTTP Kernel 的$routeMiddleware 属性中的 can 中间件需要作如下修改: 'can' => \Illuminate\Auth\Middleware\Authorize::class, can 中间件认证异常 如果用户没有认证的话can中间件会抛出 Illuminate\Auth\AuthenticationException异常实例,0 码力 | 691 页 | 9.37 MB | 1 年前3
The Laravel Handbook
there are other migrations, which are added by the Laravel framework itself for it’s authentication system. But let’s focus on creating a new table, let’s call it dogs . Go in the up() function of the routes are loaded by the RouteServiceProvider and all of them will | be assigned to the "web" middleware group. Make something great! | */ Route::get('/newdog', function () { return view('newdog'); the DigitalOcean panel) In Advanced Settings you can configure more details such as the Operating System, Database and PHP version: 86 I picked Postgres because I like that more, but it’s just a preference0 码力 | 111 页 | 14.25 MB | 1 年前3
Laravel 3.2 Documentationfew examples that we think make good bullet points: Bundles are Laravel's modular packaging system. The Laravel Bundle Repository is already populated with quite a few features that can be easily output the paging links in your view. Laravel automatically does the rest. Laravel's pagination system was designed to be easy to implement and easy to change. It's also important to note that just because Bundle::start. Allow the registration of custom database drivers. New, driver based authentication system. Added Input::json() method for working with applications using Backbone.js or similar. 0 码力 | 139 页 | 1.13 MB | 1 年前3
共 9 条
- 1













