I am new to laravel 5.4 and I am trying to practice some laravel stuffs. I want to create a feature of email verification when the applicant sign up and verifies his/her email before the applicant can login. But when I click the link below in order to verify the email address of the applicant I encounter this error. I don't know if I messed up with my route and having a hard time to resolve this. here is the link of the to verify the email address http://ift.tt/2fkjyAE.
Here is the code in my route:
Route::group(['prefix' => 'applicant', 'namespace' => 'Applicant'], function () {
Route::get('/', 'LoginController@showLoginForm');
Route::post('/login', 'LoginController@authenticate')->name('applicant.login');
Route::post('/logout', 'LoginController@logout')->name('logout');
Route::get('/home', 'HomeController@index')->name('applicant.home');
Route::get('/signup', 'LoginController@signup')->name('applicant.signup');
Route::post('/register_check', 'LoginController@store')->name('register_check');
Route::resource('applications', 'ApplicationController',
['as' => 'applicant']);
Route::get('/verify', 'LoginController@confirm')->name('applicant.verify');
//secured file view only by customer-relations
Route::get('applications/print/{application_number}', [
'as' => 'applicant.application-form.print',
'uses' => 'ApplicationController@printApplicationConfirmation',
]);
});
Heres the code in my controller:
public function store(CreateApplicantRequest $request)
{
$input = $request->all();
$confirmation_code = str_random(30);
$data = array('confirmation_code'=>$confirmation_code);
$applicants = $this->applicantRepository->create([
'name' => $input['name'],
'email' => $input['email'],
'password' => bcrypt($input['password']),
'address' => $input['address'],
'cellphone_no' => $input['cellphone_no'],
'confirmation_code' => $confirmation_code
]);
Mail::send('applicant-dashboard.verify', compact('confirmation_code'), function($message) {
$message->to(Input::get('email'), Input::get('name'))
->subject('Verify your email address');
});
Flash::message('Thanks for signing up! Please check and verify your email.');
return redirect(url('applicant'));
}
public function confirm($confirmation_code)
{
if( ! $confirmation_code)
{
throw new InvalidConfirmationCodeException;
}
$applicant = Applicant::whereConfirmationCode($confirmation_code)->first();
if ( ! $user)
{
throw new InvalidConfirmationCodeException;
}
$applicant->confirmed = 1;
$applicant->confirmation_code = null;
$applicant->save();
Flash::message('You have successfully verified your account.');
return Redirect::url('applicant');
}
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2hAGXOV
via IFTTT
Aucun commentaire:
Enregistrer un commentaire