*/ use Billable, HasApiTokens, HasFactory, Notifiable, SoftDeletes; /** * The attributes that are mass assignable. * * @var list */ protected $fillable = [ 'email', 'password', 'uuid', 'google_id', ]; /** * The attributes that should be hidden for serialization. * * @var list */ protected $hidden = [ 'password', 'remember_token', 'id', 'created_at', 'updated_at', 'deleted_at', 'uuid', 'stripe_id', 'google_id', 'email_verified_at', 'pm_last_four', 'pm_type', 'trial_ends_at', 'email', ]; protected $appends = ['ids']; protected function ids(): Attribute { return Attribute::make( get: fn($value, $attributes) => hashids_encode($attributes['id']), ); } /** * Get the attributes that should be cast. * * @return array */ protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'password' => 'hashed', ]; } /** * The "booted" method of the model. */ protected static function booted(): void { static::creating(function ($model) { $model->uuid = $model->uuid ?? (string) Str::uuid(); }); } public function user_usage() { return $this->hasOne(UserUsage::class, 'user_id'); } public function user_plan() { return $this->hasOne(UserPlan::class, 'user_id'); } public function plan() { return $this->hasOneThrough(Plan::class, UserPlan::class, 'user_id', 'id', 'id', 'plan_id'); } }