public function validateCredentials(UserInterface $user, array $credentials)
 {
     if (isset($credentials['access_token'])) {
         $token = Token::where('access_token', '=', $credentials['access_token'])->forUser($user)->first();
         // refresh the token
         $token->touch();
         return $token->isValid();
     }
     return false;
 }
 public function store()
 {
     $input = \Input::get('credentials') ?: [];
     $validator = \Validator::make($input, ['username' => ['required_without:customers_email_address'], 'customers_email_address' => ['required_without:username'], 'password' => ['required']]);
     if ($validator->passes()) {
         if (\Auth::once($input)) {
             try {
                 $token = Token::renewOrCreate(\Auth::user());
             } catch (\Exception $e) {
                 return $this->internalServerError($e->getMessage());
             }
             return $this->created($token);
         } else {
             return $this->unauthorized();
         }
     } else {
         return $this->badRequest($validator);
     }
 }