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

Laravel 動(dòng)作未定義

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

問題描述

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

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ò)誤來自這一行:

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 升級指南對遷移控制器做了以下說明:

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ì)在本指南中遷移到完整命名空間,請將 app/Http/Controllers 目錄添加到您的 composer.json 文件的 classmap 指令中.接下來,您可以從抽象的 app/Http/Controllers/Controller.php 基類中刪除命名空間.驗(yàn)證您遷移的控制器是否擴(kuò)展了這個(gè)基類.

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ì)解決您的問題.

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

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

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(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 的角色,如何只允許管理員訪問某些根)
Laravel Auth - use md5 instead of the integrated Hash::make()(Laravel Auth - 使用 md5 而不是集成的 Hash::make())
主站蜘蛛池模板: 一区二区成人 | 日韩精品一区二区三区中文在线 | 五月激情综合 | 婷婷在线视频 | 中文字幕视频在线观看 | 91精品一区二区三区久久久久 | 中文字幕乱码一区二区三区 | 亚洲欧美在线一区 | 免费一区在线 | 日韩在线免费视频 | 亚洲国产成人精品久久久国产成人一区 | 欧美日韩视频在线 | 国产盗摄视频 | 国产成人叼嘿视频在线观看 | 久草久草久草 | 久久久夜色精品亚洲 | 北条麻妃一区二区三区在线视频 | 国产一级片在线观看视频 | 久久精品国产免费 | a级片网站 | 国产激情一区二区三区 | 亚洲精品久久久一区二区三区 | 欧美日产国产成人免费图片 | 一区二区三区精品视频 | 国产欧美一区二区三区久久手机版 | 成人a视频片观看免费 | 69电影网 | 91观看 | 日韩 国产 在线 | 欧美性一级 | 91亚洲国产成人精品一区二三 | 免费视频一区二区三区在线观看 | 国产欧美一区二区精品久导航 | 麻豆av一区二区三区久久 | 精品国产一区二区国模嫣然 | 欧美午夜一区二区三区免费大片 | 国产精品免费看 | 黄网站涩免费蜜桃网站 | 亚洲黄色一区二区三区 | 成人av一区二区三区 | 成人福利网站 |