From da5fbb9233752cd07c399a20ac6b1e400b6b0113 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 13 Feb 2026 09:22:03 -0600 Subject: [PATCH] use attributes on user model --- app/Models/User.php | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/app/Models/User.php b/app/Models/User.php index 749c7b77..cfe07abc 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -3,36 +3,19 @@ namespace App\Models; // use Illuminate\Contracts\Auth\MustVerifyEmail; +use Illuminate\Database\Eloquent\Attributes\Fillable; +use Illuminate\Database\Eloquent\Attributes\Hidden; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; +#[Fillable(['name', 'email', 'password'])] +#[Hidden(['password', 'remember_token'])] class User extends Authenticatable { /** @use HasFactory<\Database\Factories\UserFactory> */ use HasFactory, Notifiable; - /** - * The attributes that are mass assignable. - * - * @var list - */ - protected $fillable = [ - 'name', - 'email', - 'password', - ]; - - /** - * The attributes that should be hidden for serialization. - * - * @var list - */ - protected $hidden = [ - 'password', - 'remember_token', - ]; - /** * Get the attributes that should be cast. *