What it has to do :
I am trying to create my own password reset from scratch using Laravel. I have a password_resets table which has 3 columns : email, token, created_at . I am getting the user to enter his email to which the password reset mail is to be sent. After the user enters the email, the function "send" in my ResetController checks whether the the email id exists in the table of users. If it exists, then a token is created and then the email and token is stored in the password_resets table. Then a recovery mail is sent to the email address with a link to reset the password.
Where it goes wrong
When I try to save the data to my password_resets table, laravel throws this error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'updated_at' in 'field list' (SQL: insert into
password_resets
(updated_at
,created_at
) values (2018-07-07 13:11:15, 2018-07-07 13:11:15))
But there is no updated_at column in my password_resets table
Below is the Structure of the password_resets table :
email varchar(191) - token varchar(191) - created_at timestamp
My ResetController file :
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\User;
use App\PasswordReset;
class ResetController extends Controller
{
public function show()
{
return view('reset.index');
}
public function send()
{
$email = request('resetemail');
if(User::get()->where('email','[email protected]')!=null)
{
$token = bin2hex(openssl_random_pseudo_bytes(16));
PasswordReset::create([
'email'=> $email,
'token'=> $token
]);
}
}
}