belongsTo(User::class, 'creator_id', 'id'); } public function categories() { return $this->morphToMany(Category::class, 'categorizable'); } public function upload() { return $this->morphToMany(Upload::class, 'uploadable'); } public function getTypeAttribute($value) { switch ($value) { case 0: $type = 'ساده'; break; case 1: $type = 'متغیر'; break; case 2: $type = 'باندل'; break; default: $type = ''; } return $type; } public function getStatusAttribute($value) { switch ($value) { case 0: $type = 'ناموجود'; break; case 1: $type = 'موجود'; break; default: $type = ''; } return $type; } }