⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.52
Server IP:
95.217.99.93
Server:
Linux sv1.sonichosted.com 4.18.0-553.34.1.lve.el8.x86_64 #1 SMP Thu Jan 9 16:30:32 UTC 2025 x86_64
Server Software:
LiteSpeed
PHP Version:
8.2.29
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
lifestylescentra
/
public_html
/
app
/
Models
/
Edit File: Category.php
hasOne(ProductCategoryTranslation::class, 'product_category_id', 'id')->where('lang_code', getSessionLanguage()); } public function getTranslation($code): ?ProductCategoryTranslation { return $this->hasOne(ProductCategoryTranslation::class, 'product_category_id', 'id')->where('lang_code', $code)->first(); } public function translations(): ?HasMany { return $this->hasMany(ProductCategoryTranslation::class, 'product_category_id'); } public function getNameAttribute(): ?string { return $this->translation?->name; } public function getDescriptionAttribute(): ?string { return $this->translation?->description; } public function productCategories() { return $this->hasMany(ProductCategory::class); } // Define the relationship with Product through ProductCategory public function products() { return $this->belongsToMany(Product::class, 'product_categories'); } public function parent(): ?HasOne { return $this->hasOne(Category::class, 'id', 'parent_id'); } public function children(): ?HasMany { return $this->hasMany(Category::class, 'parent_id', 'id'); } }
Simpan