0
votes

I am developing a Laravel application. Now, I am trying to customise the password reset feature. I am trying to get the user by password reset token. I looked at the underlying database schema. There is a table called, password_resets. It has email, token and created_at columns. I can get the email of the user by token from that table. The thing is since there is no model created for that table, I will have to write the SQL query manually like this.

DB::select('SELECT * FROM password_resets WHERE token=?', [ $token ])

or the query builder

DB::table('password_resets')->where('token',$token)->first();

But I am trying to avoid using manual query. Is there a way to get the user by password reset token without writing manual SQL query?

1
Maybe have a look at the methods inside the `DatabaseTokenRepository. Not sure if that's the sort of thing you're looking for. - D Malan

1 Answers

2
votes
DB::table('password_resets')->where('token',$token)->first();