I'm trying to make a simple "forgot password" function, so everything works but I don't know how to put in my variabel into blade file.
Here's my source:
public function postForgot(Request $request) {
$token = bin2hex(openssl_random_pseudo_bytes(16));
$this->validate($request, [
'email' => 'required|email|max:255|min:3',
]);
if (User::where('email', '=', $request->input('email'))->exists()) {
// user found
Mail::send('emails.forgot', function($message) {
$message->to($_POST['email'],$_POST['email'])->subject('We almost got your password back...');
});
} else {
echo "Not found user";
}
}
Route file:
Route::get('/forgot/new_password', [
'uses' => '\Zyllox\Http\Controllers\AuthController@getForgotNewPassword',
]);
Route::post('/forgot/new_password', [
'uses' => '\Zyllox\Http\Controllers\AuthController@postForgotNewPassword',
'as' => 'auth.new_pass',
'middleware' => ['guest'],
]);
Here's my simple blade file:
Here's your token m8 : {{ $token }}
I want the $token variable to work inside the blade file.
Thanks!