2016-01-12 24 views
2

我有Laravel的混合和角路由問題,而試圖抓住我的非Laravel和航線目前斜視..FatalErrorException在Facade.php行216:調用未定義的方法照亮基金會應用::失蹤()

我得到了下面的錯誤,當我說我的應用程序缺少方法\ HTTP \ route.php:

FatalErrorException在Facade.php行216:調用未定義的方法照亮\基金會\應用:: missing()

我知道這會工作K罰款與laravel 5或下降版本,但不是與我目前正在使用的laravel 5.2,所以如何在laravel 5.2中編碼?任何解決方案


route.php樣子:

<?php // app/routes.php 
// HOME PAGE =================================== 
// I am not using Laravel Blade 
// I will return a PHP file that will hold all of our Angular content 

Route::get('/', function() { 
    View::make('index'); // will return app/views/index.php 
}); 
// API ROUTES ================================== 
Route::group(['prefix' => 'api'], function() { 

    // Angular will handle both of those forms 
    // this ensures that a user can't access api/create or api/edit when there's nothing there 
    Route::resource('comments', 'CommentController', 
     ['only' => ['index', 'store', 'destroy']]); 

}); 

// CATCH ALL ROUTE ============================= 
// all routes that are not home or api will be redirected to the frontend 
// this allows angular to route them 

App::missing(function($exception) { 
    return View::make('index'); 
}); 

回答

5

應用::失蹤()已Laravel 5.被刪除,您需要定義一個包羅萬象的自己的路線,只要確保你把它放在你的結束routes.php文件

Route::any('{catchall}', function() { 
    //some code 
})->where('catchall', '.*'); 
+0

由於它工作得很好......甚至我發現laracast通道此解決方案。感謝您的評論.. https://laracasts.com/discuss/channels/general-discussion/laravel-5-catch-all-route-appmissing-handle?page=1 – Himakar

+0

是有同樣的問題,但實施此它現在工作正常。謝謝@ jedrzej.kurylo –

+0

YEAH!你搖滾人!你搖滾!就是這個! –

相關問題