嗨,我正在使用slim和cartalyst \ sentinel开发登录应用程序。当我创建哨兵提醒的新实例时,$reminder = new Cartalyst\Sentinel\Reminders\IlluminateReminderRepository;
它会提示实现UserRepositoryInterface的错误error __construct() must implement interface Cartalyst\Sentinel\Users\UserRepositoryInterface
。
我的问题是我如何在运行时在php中实现接口。
而在上面我使用了激活类,该类也以src代码实现了一个接口,class IlluminateActivationRepository implements ActivationRepositoryInterface
但它不会产生错误。
下面的激活类工作正常。
$activation = (new Cartalyst\Sentinel\Activations\IlluminateActivationRepository)->create($user);
好的,我通过此提供的用户存储库对象解决了。
$users = $app->container->sentinel->getUserRepository();
$reminder = new Cartalyst\Sentinel\Reminders\IlluminateReminderRepository ( $users );
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句