【发布时间】:2015-07-12 13:34:54
【问题描述】:
我正在尝试在我的 Laravel 包中使用 Validator。从服务提供商我将验证器作为构造函数参数发送到考试类,但我收到此错误
Object of class Illuminate\Validation\Factory could not be converted to string
下面是我的服务提供者注册函数:
public function register()
{
$this->app['exam'] = $this->app->share(function($app)
{
return new Exam($this->app['session.store'],$this->app['validator']);
});
}
以及产生错误的考试构造函数:
public function __construct(SessionStore $session, Validator $validator)
{
$this->session = $session;
$this->container = 'Testum_Exam';
$this->$validator = $validator;
$this->initializeExam();
}
【问题讨论】:
标签: php laravel-4 laravel-validation