*/ protected $fillable = [ 'login', 'email', 'pass', 'type' ]; /** * The attributes that should be hidden for serialization. * * @var array */ protected $hidden = [ 'pass', 'remember_token', ]; /** * The attributes that should be cast. * * @var array */ protected $casts = [ 'email_verified_at' => 'datetime', 'password' => 'hashed', ]; /** * Map application attribute names to database column names. */ protected array $attributeMap = [ 'username' => 'login', // Map 'username' to 'login' 'password' => 'pass', // Map 'password' to 'pass' ]; /** * Override the getAttribute method to use the attribute map. */ public function getAttribute($key) { // Check if the key exists in the attribute map if (array_key_exists($key, $this->attributeMap)) { return $this->attributes[$this->attributeMap[$key]]; } // Fall back to the default behavior return parent::getAttribute($key); } /** * Override the setAttribute method to use the attribute map. */ public function setAttribute($key, $value) { // Check if the key exists in the attribute map if (array_key_exists($key, $this->attributeMap)) { $this->attributes[$this->attributeMap[$key]] = $value; return; } // Fall back to the default behavior parent::setAttribute($key, $value); } /** * Specify the password column for authentication. */ public function getAuthPassword() { return $this->pass; } /** * Specify the login column for authentication. */ public function username() { return 'login'; } public function scopeSearchFilter($query, $request) { $filters = new UserFilters(); return $filters->apply($query, $request); } public function showDjs() { return $this->hasMany(ShowHosts::class, 'subjs_id'); } }