我已經研究了這個類似問題的所有以前的答案,但我找不到任何。notfoundhttp異常,但發佈請求
我只是訪問我所做出的自定義
路線
Route::post('dashboard', 'Admin\[email protected]');
UserController.php
<?php
namespace App\Http\Controllers;
use DB;
use Session;
use App\Http\Requests;
use Illuminate\Http\Request;
class UserController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
echo "welcome"
}
}
當我嘗試這個功能,它拋出我
NotFoundHttpException在RouteCollection.php線161:
錯誤。 更新
我的所有路由都
Route::get('/', function() {
return view('welcome');
});
// Authentication routes...
Route::get('auth/login', 'Auth\[email protected]');
Route::post('auth/login', 'Auth\[email protected]');
Route::get('auth/logout', 'Auth\[email protected]');
// Registration routes...
Route::get('auth/register', 'Auth\[email protected]');
Route::post('auth/register', 'Auth\[email protected]');
// Dashboard routes
Route::post('dashboard', 'Admin\[email protected]');
Route::controllers([
'password' => 'Auth\PasswordController',
]);
'Admin'是控制器之前的目錄名? –
'php artisan route:list'檢查路由列表問題 –