我正在更新到Laravel 5.4,并在尝试显示登录屏幕时收到以下错误消息。
我收到以下错误消息:
找不到特征'Illuminate \ Foundation \ Auth \ AuthenticatesAndRegistersUsers'
这是AuthController类:
<?php
namespace App\Http\Controllers\Auth;
use App\User;
use Validator;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
class AuthController extends Controller
{
/*
|--------------------------------------------------------------------------
| Registration & Login Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users, as well as the
| authentication of existing users. By default, this controller uses
| a simple trait to add these behaviors. Why don't you explore it?
|
*/
use AuthenticatesAndRegistersUsers, ThrottlesLogins;
/**
* Where to redirect users after login / registration.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Where to redirect users after logout.
*
* @var string
*/
protected $redirectAfterLogout = '/login';
/**
* Create a new authentication controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware($this->guestMiddleware(), ['except' => ['getLogout']]);
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|min:6|confirmed',
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}
}
参考方案
使用laravel 5.4,我们在此特征上有一些更改。现在我们有两个不同的特征:
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
而且,如果您安装了新的5.4 laravel应用程序,您将看到现在有了LoginController和RegisterController而不是AuthController
PHP Laravel从另一个驱动器读取文件 - php我目前正在学习Laravel。我想知道是否有一种方法可以在Laravel中使用Storage::从另一个硬盘访问文件(使用Windows)。例如,我在驱动器C:上安装了带有Laravel的Xampp,但是我想访问网站目录之外的E:上的文件。我试过使用Storage::files('E:')和File::files('E:…
Laravel 5排序具有关系的雄辩模型 - php我有一个要基于关系属性进行排序的模型。主模型Resultado具有类型respondente的关系belongsTo,而respondente具有关系usuario。我想获取具有这些关系的Resultado并按usuario name属性(列)对结果进行排序。我试过了$resultados = Diagnostico\Resultado::with(…
检查对象是否已在集合中-Laravel - php当我循环一系列不同的结果时,我希望将对象添加到新集合中。查询:$osRed = Item::where('category', 'Hardware') ->where(function ($query) { $query->where('operating_system', '…
Laravel-使用雄辩的语言在开始日期和结束日期之间选择行 - php我想将此查询转换为雄辩的laravel,select * from schedule where (now() between start_date and end_date); 我尝试使用whereBetween,但是出现了一些错误。$schedule = Schedule::whereBetween(Carbon::now(), ['start…
laravel Hash::make继续给出不同的结果 - php我想在laravel 4中使用身份验证我改了桌子和莫贝尔的名字当用户注册时,我拥有密码并将其保存,哈希为:$password = Hash::make(Input::get('password')); 然后当用户登录时,我想先对他/她进行身份验证。我这样做是这样的:if (Auth::attempt(array('usernam…