在 Laravel 5 中找不到类'App\Http\Controllers\admin\Auth'
2022-08-30 18:03:42
我在登录期间收到错误,例如在Laravel 5中找不到类。App\Http\Controllers\admin\Auth
路线.php
Route::group(array('prefix'=>'admin'),function(){
Route::get('login', 'admin\AdminHomeController@showLogin');
Route::post('check','admin\AdminHomeController@checkLogin');
});
管理员家庭控制器.php
<?php namespace App\Http\Controllers\admin;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class AdminHomeController extends Controller {
//
public function showLogin()
{
return view('admin.login');
}
public function checkLogin(Request $request)
{
$data=array(
'username'=>$request->get('username'),
'password'=>$request->get('password')
);
if(Auth::attempt($data))
{
return redirect::intended('admin/dashboard');
}
else
{
return redirect('admin/login');
}
}
public function logout()
{
Auth::logout();
return redirect('admin/login');
}
public function showDashboard()
{
return view('admin.dashboard');
}
}
login.blade.php
<html>
<body>
{!! Form::open(array('url' => 'admin/check', 'id' => 'login')) !!}
<input type="text" name="username" id="username" placeholder="Enter any username" />
<input type="password" name="password" id="password" placeholder="Enter any password" />
<button name="submit">Sign In</button>
{!! Form::close() !!}
</body>
</html>