方法 [sendEmail] 不存在
Method [sendEmail] does not exist
我是 laravel 5.3 的新手。我正在使用 cartalyst sentinel 进行身份验证
Web.php
Route::post('/register','RegistrationController@register');
Route::get('/activate/{email}/{activationCode}' , 'RegistrationController@activate');
RegistrationController.php
public function register(Request $request){
$user = Sentinel::register($request->all());
$activation = Activation::create($user);
$role = Sentinel::findRoleBySlug('student');
$role->users()->attach($user);
$this->sendEmail($user,$activation->code);
Alert::info('Mail has been sent to activate your account', 'Confirmation Email')->persistent("Close this");
return redirect::back();
}
注册控制器中的认证方法-
public function activate($email,$activationCode){
$user = User::whereEmail($email)->first();
$sentinelUser = Sentinel::findById($user->id);
if(Activation::complete($sentinelUser, $activationCode)){
return redirect('/');
}
}
当我尝试提交按钮时出现此错误 -
BadMethodCallException in Controller.php line 82: Method [sendEmail] does not exist.
请帮帮我,谢谢
$this->sendEmail($user,$activation->code);
正在尝试调用一个应该存在于某处的方法,但它没有找到它。
您可以简单地在某处使用您想要的所有逻辑定义函数。例如
private function SendEmail($user, $activation->code) {
// your logic goes here
}
希望这能解决您的问题....
我是 laravel 5.3 的新手。我正在使用 cartalyst sentinel 进行身份验证
Web.php
Route::post('/register','RegistrationController@register');
Route::get('/activate/{email}/{activationCode}' , 'RegistrationController@activate');
RegistrationController.php
public function register(Request $request){
$user = Sentinel::register($request->all());
$activation = Activation::create($user);
$role = Sentinel::findRoleBySlug('student');
$role->users()->attach($user);
$this->sendEmail($user,$activation->code);
Alert::info('Mail has been sent to activate your account', 'Confirmation Email')->persistent("Close this");
return redirect::back();
}
注册控制器中的认证方法-
public function activate($email,$activationCode){
$user = User::whereEmail($email)->first();
$sentinelUser = Sentinel::findById($user->id);
if(Activation::complete($sentinelUser, $activationCode)){
return redirect('/');
}
}
当我尝试提交按钮时出现此错误 -
BadMethodCallException in Controller.php line 82: Method [sendEmail] does not exist.
请帮帮我,谢谢
$this->sendEmail($user,$activation->code);
正在尝试调用一个应该存在于某处的方法,但它没有找到它。
您可以简单地在某处使用您想要的所有逻辑定义函数。例如
private function SendEmail($user, $activation->code) {
// your logic goes here
}
希望这能解决您的问题....