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

Laravel 動(dòng)作未定義

Laravel action not defined(Laravel 動(dòng)作未定義)
本文介紹了Laravel 動(dòng)作未定義的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

從 Laravel 4.2 更新到 5.0 后,我?guī)缀踉趹?yīng)用程序的每個(gè)頁(yè)面中都收到以下消息:

After updating from Laravel 4.2 to 5.0, I am getting the following message in almost every page of my application:

UrlGenerator.php 第 561 行中的 InvalidArgumentException:未定義 Action ArticlesController@create.

在我的 routes.php 文件中,我有:

In my routes.php file I have:

Route::get('articles/create', ['as' => 'articles.create', 'uses' => 'ArticlesController@create']);
Route::post('articles/create', ['as' => 'articles.create.handle', 'uses' => 'ArticlesController@handleCreate']);

在我的控制器中:

class ArticlesController extends Controller {

    public function create()
    {
        $input=null;
        if (Input::old()) {
            $input = Input::old();
        }
        $tagsJson = Tag::all()->toJson();
        $categories = ArticleCategory::all();
        return View::make('admin.articles.create', compact(array('tagsJson', 'categories', 'input')));
    }

    public function handleCreate()
    {
        $input = Input::all();

        if ($input['op']=="preview") {
            return redirect()->action('ArticlesController@create')->withInput();
        } else if ($input['op']=="post") {
            //
        }

    }
}

我得到的錯(cuò)誤來(lái)自這一行:

The error I get comes from this line:

return redirect()->action('ArticlesController@create')->withInput();

有什么幫助嗎?謝謝,伊利亞斯

Any help? Thanks, Ilias

推薦答案

您收到此錯(cuò)誤是因?yàn)?Laravel 5 默認(rèn)使用命名空間.官方 Laravel 5 升級(jí)指南對(duì)遷移控制器做了以下說(shuō)明:

You are getting this error because Laravel 5 uses namespacing by default. The official Laravel 5 upgrade guide says the following about migrating your controllers:

由于我們不會(huì)在本指南中遷移到完整命名空間,請(qǐng)將 app/Http/Controllers 目錄添加到您的 composer.json 文件的 classmap 指令中.接下來(lái),您可以從抽象的 app/Http/Controllers/Controller.php 基類(lèi)中刪除命名空間.驗(yàn)證您遷移的控制器是否擴(kuò)展了這個(gè)基類(lèi).

Since we are not going to migrate to full namespacing in this guide, add the app/Http/Controllers directory to the classmap directive of your composer.json file. Next, you can remove the namespace from the abstract app/Http/Controllers/Controller.php base class. Verify that your migrated controllers are extending this base class.

在您的 app/Providers/RouteServiceProvider.php 文件中,將命名空間屬性設(shè)置為 null.

In your app/Providers/RouteServiceProvider.php file, set the namespace property to null.

在控制器"下此處列出.

最后一行可能會(huì)解決您的問(wèn)題.

The last line is probably the one that will solve your issue.

這篇關(guān)于Laravel 動(dòng)作未定義的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

Laravel Eloquent Union query(Laravel Eloquent Union 查詢)
Overwrite laravel 5 helper function(覆蓋 Laravel 5 輔助函數(shù))
laravel querybuilder how to use like in wherein function(laravel querybuilder 如何在 where 函數(shù)中使用 like)
The Response content must be a string or object implementing __toString(), quot;booleanquot; given after move to psql(響應(yīng)內(nèi)容必須是實(shí)現(xiàn) __toString()、“boolean和“boolean的字符串或?qū)ο?移動(dòng)到 psql 后給出) - IT屋-程
Roles with laravel 5, how to allow only admin access to some root(Laravel 5 的角色,如何只允許管理員訪問(wèn)某些根)
Laravel Auth - use md5 instead of the integrated Hash::make()(Laravel Auth - 使用 md5 而不是集成的 Hash::make())
主站蜘蛛池模板: 天天天插 | 午夜视频在线观看一区二区 | 中文精品久久 | 精品久久久久久久久久久久久 | 男人久久天堂 | 日本三级日产三级国产三级 | 日韩欧美三区 | 免费观看一级毛片 | 香蕉大人久久国产成人av | www.国产.com | 中国一级特黄真人毛片免费观看 | 国产日韩精品一区 | 久久专区 | 成人精品一区二区三区中文字幕 | 日韩一区二区三区精品 | 久久高清精品 | 九九热免费在线观看 | 欧美在线观看一区 | 天天影视亚洲综合网 | 五月天婷婷久久 | 97精品超碰一区二区三区 | 国产成人综合在线 | 成人伊人| 成人妇女免费播放久久久 | 国产激情在线观看视频 | 免费黄色录像片 | 手机看片169 | 99视频在线免费观看 | 福利久久| 国产成人精品午夜视频免费 | 成人激情视频网 | 久久黄网 | 国产激情片在线观看 | 国产亚洲精品久久久优势 | 亚洲视频中文字幕 | 久久免费视频观看 | 久久精品日产第一区二区三区 | 在线观看日本高清二区 | 青娱乐自拍 | 久久久久久久一级 | 色伊人 |