Facade.php 第 216 行中的 FatalErrorException:调用未定义的方法 Illuminate\Foundation\Application::missing()
FatalErrorException in Facade.php line 216: Call to undefined method Illuminate\Foundation\Application::missing()
我在尝试捕获我的非Laravel 路由并呈现Angular 视图时遇到了混合使用Laravel 和Angular 路由的问题..
我在 app\http\route.php 中添加缺少的方法时出现以下错误:
Facade.php 第 216 行中的 FatalErrorException:调用未定义的方法 Illuminate\Foundation\Application::missing()
我知道这在 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');
});
App::missing() 已在 Laravel 5 中删除。您需要自己定义一条 catch-all 路线,只需确保将其放在 routes.php:
的末尾即可
Route::any('{catchall}', function() {
//some code
})->where('catchall', '.*');
我在尝试捕获我的非Laravel 路由并呈现Angular 视图时遇到了混合使用Laravel 和Angular 路由的问题..
我在 app\http\route.php 中添加缺少的方法时出现以下错误:
Facade.php 第 216 行中的 FatalErrorException:调用未定义的方法 Illuminate\Foundation\Application::missing()
我知道这在 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');
});
App::missing() 已在 Laravel 5 中删除。您需要自己定义一条 catch-all 路线,只需确保将其放在 routes.php:
的末尾即可Route::any('{catchall}', function() {
//some code
})->where('catchall', '.*');