*/ protected $fillable = [ 'name', 'email', 'password', 'nik', 'branch_id', 'profile_photo_path', 'last_login_at', 'last_login_ip', 'sign' ]; /** * The attributes that should be hidden for serialization. * * These are the attributes that will be hidden when the model is converted to an array or JSON. * * @var array */ protected $hidden = [ 'password', 'remember_token', ]; /** * Get the attributes that should be cast. * * This method defines how the attributes should be cast when accessed. * In this case, 'email_verified_at' is cast to 'datetime', 'password' is cast to 'hashed', and 'id' is cast to 'string'. * * @return array */ protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'password' => 'hashed', 'id' => 'string', ]; } public function branch() { return $this->belongsTo(Branch::class); } /** * Create a new factory instance for the model. * * @return \Illuminate\Database\Eloquent\Factories\Factory */ protected static function newFactory() { return \Modules\Usermanagement\Database\Factories\UserFactory::new(); } /** * Get all of the appointments for the User * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function appointments() { return $this->hasMany(Appointment::class, 'admin_id'); } public function appointment_cabangs() { return $this->hasMany(Appointment::class, 'admin_id'); } public function branches() { return $this->belongsToMany(Branch::class, 'user_branches', 'user_id', 'branch_id') ->withTimestamps(); } }