久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在 Laravel 5 中擴展請求類

Extend Request class in Laravel 5(在 Laravel 5 中擴展請求類)
本文介紹了在 Laravel 5 中擴展請求類的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我是 Laravel 的新手(只體驗過 Laravel 5,所以這里沒有遺留問題)

我想知道如何擴展核心請求類.除了如何擴展它之外,我想知道這樣做是否是一個明智的設計決定.

我已經廣泛閱讀了文檔(特別是關于注冊服務提供者以及它提供 Facades 訪問依賴項容器內的條目的方式) - 但我可以看到(并找到)沒有辦法替換 IlluminateHttpRequest 實例與我自己的

解決方案

這里是官方文檔:Request Lifecycle >

app/Http/CustomRequest.php 的內容

將此行添加到 public/index.php

$app->alias('request', 'AppHttpCustomRequest');

之后

app = require_once __DIR__.'/../bootstrap/app.php';

更改 public/index.php 中的代碼

IlluminateHttpRequest::capture()

AppHttpCustomRequest::capture()

I'm new to Laravel (only experienced Laravel 5, so no legacy hang up here)

I'd like to know how to extend the core Request class. In addition to how to extend it, i'd like to know if it's a wise design decision to do so.

I've read through the documentation extensively (especially with regards to registering service providers and the manner in which it provides Facades access to entries within the dependency container) - but I can see (and find) no way to replace the IlluminateHttpRequest instance with my own

解決方案

Here is Official Document: Request Lifecycle

Content of app/Http/CustomRequest.php

<?php namespace AppHttp;

use IlluminateHttpRequest as BaseRequest;

class CustomRequest extends BaseRequest {
    // coding
}

add this line to public/index.php

$app->alias('request', 'AppHttpCustomRequest');

after

app = require_once __DIR__.'/../bootstrap/app.php';

change the code at public/index.php

IlluminateHttpRequest::capture()

to

AppHttpCustomRequest::capture()

這篇關于在 Laravel 5 中擴展請求類的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Laravel Eloquent Union query(Laravel Eloquent Union 查詢)
Overwrite laravel 5 helper function(覆蓋 Laravel 5 輔助函數)
laravel querybuilder how to use like in wherein function(laravel querybuilder 如何在 where 函數中使用 like)
The Response content must be a string or object implementing __toString(), quot;booleanquot; given after move to psql(響應內容必須是實現 __toString()、“boolean和“boolean的字符串或對象.移動到 psql 后給出) - IT屋-程
Roles with laravel 5, how to allow only admin access to some root(Laravel 5 的角色,如何只允許管理員訪問某些根)
Laravel Auth - use md5 instead of the integrated Hash::make()(Laravel Auth - 使用 md5 而不是集成的 Hash::make())
主站蜘蛛池模板: 每日更新av | 国精产品99永久一区一区 | 黄色免费网站在线观看 | 欧美日韩色 | a级片久久 | 色在线视频 | 国产视频一区二 | 伊人av网 | 韩国精品一区二区 | 亚洲一区二区免费 | 青草福利视频 | 天天操夜夜爽 | 茄子视频色 | 亚洲综合影院 | 久久久网 | 亚洲精品在线视频观看 | 可以看的毛片 | 一区二区三区在线免费 | 涩涩视频免费观看 | 日韩二区三区 | 欧美三级三级三级爽爽爽 | 中文字幕综合网 | 少妇搡bbbb搡bbb搡毛茸茸 | 亚洲黄色片 | 欧美在线日韩 | 小sao货撅起屁股扒开c微博 | 伊人久久网站 | 亚洲一区成人 | 精品久久久一区二区 | 中文字幕免费看 | 在线观看h视频 | 欧美顶级黄色大片免费 | 久久国产亚洲 | 国产深夜福利 | 亚洲精品911 | 亚洲欧美视频一区 | 中文在线字幕免费观 | 免费久久久 | 国产超碰在线 | 伊人网在线 | 久久久久一区二区三区 |