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

Laravel 動作未定義

Laravel action not defined(Laravel 動作未定義)
本文介紹了Laravel 動作未定義的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

從 Laravel 4.2 更新到 5.0 后,我幾乎在應用程序的每個頁面中都收到以下消息:

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") {
            //
        }

    }
}

我得到的錯誤來自這一行:

The error I get comes from this line:

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

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

Any help? Thanks, Ilias

推薦答案

您收到此錯誤是因為 Laravel 5 默認使用命名空間.官方 Laravel 5 升級指南對遷移控制器做了以下說明:

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:

由于我們不會在本指南中遷移到完整命名空間,請將 app/Http/Controllers 目錄添加到您的 composer.json 文件的 classmap 指令中.接下來,您可以從抽象的 app/Http/Controllers/Controller.php 基類中刪除命名空間.驗證您遷移的控制器是否擴展了這個基類.

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 文件中,將命名空間屬性設置為 null.

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

在控制器"下此處列出.

最后一行可能會解決您的問題.

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

這篇關于Laravel 動作未定義的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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())
主站蜘蛛池模板: 欧美精品国产精品 | 999精品在线观看 | 欧美a在线看 | 国内自拍偷拍一区 | 免费在线观看一级毛片 | 亚洲激情一区二区 | 精品欧美乱码久久久久久 | 精品国产乱码久久久久久牛牛 | 国产日韩一区 | 日本高清不卡视频 | 午夜电影福利 | 成人亚洲网 | 免费一二区| 国产精品久久久久久久久久久久久 | 国产一区二区三区在线 | 中文字幕一区在线观看视频 | 久久机热| 亚洲视频精品在线 | 亚洲视频欧美视频 | 亚洲成人精品在线观看 | 久久久久国产一级毛片 | 国产激情视频网站 | 91精品国产一区二区三区 | 久久国内精品 | 日韩中文在线观看 | 二区视频 | 成人天堂噜噜噜 | 亚洲午夜精品一区二区三区他趣 | 国产乱码精品一区二区三区中文 | av在线一区二区三区 | 精品福利av导航 | 日韩一级 | 爱爱小视频 | 久久午夜精品 | 日韩精品一区二区三区在线播放 | 国产成人a亚洲精品 | 亚洲一二三区在线观看 | 午夜久草 | 国产伦一区二区三区久久 | 欧美在线激情 | 国产日韩欧美一区二区 |