'float', 'active' => 'int', 'network_id' => 'int' ]; protected $dates = [ 'date_modified', 'date_created' ]; protected $hidden = [ 'encrypted_password' ]; protected $fillable = [ 'uid', 'firstname', 'lastname', 'phone', 'email', 'adresse', 'solde', 'encrypted_password', 'salt', 'validation_code', 'active', 'date_modified', 'date_created' ]; /** * Find the user instance for the given username. * * @param string $username * @return \App\Models\User */ public function findForPassport($username) { // return $this->where('phone', $username)->first(); return $this->where('email', $username)->orWhere('phone', $username)->first(); } /** * Validate the password of the user for the Passport password grant. * * @param string $password * @return bool */ public function validateForPassportPasswordGrant($password) { // return Hash::check($password, $this->password); $encrypted_password = base64_encode(sha1($password . $this->salt, true) . $this->salt); return $this->encrypted_password == $encrypted_password; } }