久久久久久久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())
主站蜘蛛池模板: 亚洲一区二区国产 | 最新超碰| 1区2区视频| 91在线观看| japanhd美女动 | 波多野结衣在线观看一区二区三区 | 亚洲国产福利视频 | 免费一级欧美在线观看视频 | 亚洲一区有码 | 盗摄精品av一区二区三区 | 伊人精品在线视频 | 国产aⅴ爽av久久久久久久 | 日韩在线一区二区 | 亚洲精品 在线播放 | 中文字幕精品一区二区三区精品 | 羞羞涩涩在线观看 | 国产一区二区 | 欧美日韩国产精品一区 | 美国黄色一级片 | 中文字幕在线精品 | 大象一区 | 99精品国自产在线 | 成人免费共享视频 | 亚洲欧洲成人 | 欧美精品一区二区三区四区 在线 | 日韩成人av在线 | 视频在线亚洲 | 久久久久综合 | 懂色av一区二区三区在线播放 | 成人免费区一区二区三区 | 亚洲黄色一级毛片 | 美人の美乳で授乳プレイ | 少妇一区二区三区 | 亚洲欧洲成人在线 | 日韩一区在线播放 | 五月综合激情网 | 日韩成人免费中文字幕 | 欧美99| 国产精品久久久久久婷婷天堂 | 亚洲国产精品日本 | 三级黄色网址 |