mardi 12 juin 2018

How to get most recent data from table? Laravel 5.5, MySQL

I have this simple function to get the token of a user.

However, if a user has just been added, I'd need to refresh data in MySQL Workbench before the code can pull it via code which would be a problem on production.

public function getToken($user_id) {
    $token = \DB::table('social_providers')->where('user_id', $user_id)->value('token');
    return $token;
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire