'array'];
public function scopeActive($query)
{
return $query->where('status', Status::ENABLE);
}
public function subCategories()
{
return $this->belongsToMany(SubCategory::class);
}
public function products()
{
return $this->hasMany(Product::class, 'assigned_to');
}
public function approvedProducts()
{
return $this->hasMany(Product::class, 'approved_by');
}
public function statusBadge(): Attribute
{
return new Attribute(function () {
$html = '';
if ($this->status == Status::ENABLE) {
$html = '' . trans('Active') . '';
} else {
$html = '' . trans('Banned') . '';
}
return $html;
});
}
}