久久久久久久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区3区 成人黄页在线观看 | 日韩超碰在线 | 成人精品一区二区三区中文字幕 | 国产偷自视频区视频 | 欧美黄色免费网站 | 91视频免费 | 国产一二区视频 | 欧美综合久久久 | 天天做日日做 | av在线三级 | 一区日韩| 欧美一区二区三区在线观看 | 手机在线观看av | 91精品国产欧美一区二区 | 影音先锋中文字幕在线观看 | 日韩av一区在线观看 | 国产精品99久久久久久宅男 | 日韩欧美在线视频 | 日韩一区在线观看视频 | 99热欧美| 91国内外精品自在线播放 | 日韩欧美在线视频 | 亚洲精品国产综合区久久久久久久 | 欧美性生活网 | 午夜影院 | 国产精品久久久久久福利一牛影视 | 二区不卡 | 一区网站| www.9191.com| 久久99精品久久久久久秒播九色 | 国产99视频精品免费播放照片 | 国产欧美一区二区精品久导航 | 91在线精品播放 | 国产精品高潮呻吟久久av黑人 | 91极品尤物在线播放国产 | 精品欧美激情精品一区 | 久久久久一区 | 欧美一区二区小视频 |