*/ protected $fillable = [ 'username', 'name', 'description', 'image', 'email', 'password', 'email_verified_at' ]; /** * The attributes that should be hidden for serialization. * * @var array */ protected $hidden = [ 'password', 'remember_token', ]; /** * The attributes that should be cast. * * @var array */ protected $casts = [ 'email_verified_at' => 'datetime', 'password' => 'hashed', ]; public function blogs(): HasMany { return $this->hasMany(Blog::class); } public function likes() { return $this->belongsToMany(Blog::class, 'likes'); } public function follows() { return $this->belongsToMany(User::class, 'follows', 'follower_id', 'followed_id'); } public function followed() { return $this->belongsToMany(User::class, 'follows', 'followed_id', 'follower_id'); } }