久久久久久久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())
主站蜘蛛池模板: 日韩精品成人 | 中文字幕二区 | 久久精品欧美电影 | 亚洲一区二区三区在线观看免费 | 久久久久久免费毛片精品 | 成人精品一区二区 | 99免费在线视频 | 久久久久久国产精品免费免费狐狸 | 欧美福利视频 | 一久久久| 国产精品久久久久久久久久三级 | 国产一区亚洲二区三区 | 91精品一区二区 | 亚洲一区二区三区欧美 | 国产视频二区 | 色成人免费网站 | 久久精品中文 | 激情网站在线观看 | 中国大陆高清aⅴ毛片 | 神马九九 | 亚洲欧美少妇 | 97热在线 | 国产精品视频免费观看 | 欧美a级成人淫片免费看 | av在线亚洲天堂 | 亚洲视频一区二区三区 | 韩日一区二区三区 | 国产激情一区二区三区 | 337p日本欧洲亚洲大胆 | 久久新视频 | 久久国产精品99久久久久 | 精品美女视频在线观看免费软件 | 国产欧美一区二区三区久久 | 欧美精品三区 | 在线国产欧美 | 精品一区二区久久 | 久久久天堂 | a级毛片免费高清视频 | 中文字幕一区在线观看视频 | 国产精品久久久久国产a级 欧美日韩国产免费 | 国产国产精品 |