Laravel 4.2:Ollieread MultiAuth 提醒问题
Posted
技术标签:
【中文标题】Laravel 4.2:Ollieread MultiAuth 提醒问题【英文标题】:Laravel 4.2: Issue with Ollieread MultiAuth Reminders 【发布时间】:2015-12-04 14:16:46 【问题描述】:我第一次尝试为我的 L-4.2 项目集成多身份验证。一切似乎都正常,但提醒不起作用。当我在密码/提醒页面输入电子邮件地址并提交时,它给了我一个错误:
传递给 Ollieread\Multiauth\Reminders\PasswordBrokerManager::__construct() 的参数 1 必须是 Ollieread\Multiauth\Reminders\ReminderRepositoryInterface 的实例,给定的 Illuminate\Auth\Reminders\DatabaseReminderRepository 的实例,在 D:... 中调用.\vendor\ollieread\multiauth\src\Ollieread\Multiauth\Reminders\ReminderServiceProvider.php 在第 59 行并定义
您可以在此处查看完整的错误详细信息:http://awesomescreenshot.com/08a57ye350
型号
use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;
class Admin extends Eloquent implements UserInterface, RemindableInterface
use UserTrait, RemindableTrait;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'admins';
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = array('password', 'remember_token');
// fillable array
protected $fillable = array('name', 'email', 'password');
// validation rules
public static $rules = array(
'name' => 'required|min:2', // alpha = only alphabets
'email' => 'required|email|unique:admins', // unique in admins table
'password' => 'required|between:8,20|confirmed',
'password_confirmation' => 'required|between:8,20'
);
AdminRemindersController
class AdminRemindersController extends Controller
/**
* Display the password reminder view.
*
* @return Response
*/
public function getRemind()
return View::make('admin.password.remind');
/**
* Handle a POST request to remind a user of their password.
*
* @return Response
*/
public function postRemind()
$response = Password::admin()->remind(Input::only('email'), function($message)
$message->subject('Password Reminder');
);
switch ($response)
case Password::INVALID_USER:
return Redirect::back()
->with('message', Lang::get($response))
->with('message-type', 'alert-danger');
case Password::REMINDER_SENT:
return Redirect::back()
->with('message', Lang::get($response))
->with('message-type', 'alert-success');
/**
* Display the password reset view for the given token.
*
* @param string $token
* @return Response
*/
public function getReset($token = null)
if (is_null($token)) App::abort(404);
return View::make('admin.password.reset')->with('token', $token);
/**
* Handle a POST request to reset a user's password.
*
* @return Response
*/
public function postReset()
$credentials = Input::only(
'email', 'password', 'password_confirmation', 'token'
);
$response = Password::admin()->reset($credentials, function($user, $password)
$user->password = Hash::make($password);
$user->save();
);
switch ($response)
case Password::INVALID_PASSWORD:
case Password::INVALID_TOKEN:
case Password::INVALID_USER:
return Redirect::back()->with('error', Lang::get($response));
case Password::PASSWORD_RESET:
return Redirect::to('admin.login')
->with('message', 'Password changed successfully.')
->with('message-type', 'alert-success');
请帮忙。
【问题讨论】:
【参考方案1】:好的,我找到了问题所在。我不得不用 Multi Auth 服务提供者替换默认的 Auth 服务提供者。就我而言,我确实替换了以下提醒服务提供商:
'Illuminate\Auth\Reminders\ReminderServiceProvider',
替换为:
'Ollieread\Multiauth\Reminders\ReminderServiceProvider'
现在错误消失了。
【讨论】:
以上是关于Laravel 4.2:Ollieread MultiAuth 提醒问题的主要内容,如果未能解决你的问题,请参考以下文章
text 用于Laravel 4.2 #laravel的PHP 7.1加密器
从 4.1 升级到 4.2 后 Laravel 控制器路由中断
Laravel 升级到 4.2 - 需要 mcrypt 扩展