fix service cant show

This commit is contained in:
baodev0
2026-10-01 10:05:45 +07:00
parent 37417cb5e0
commit a1aeb88061
2 changed files with 30 additions and 0 deletions
+9
View File
@@ -17,6 +17,15 @@ class Service extends Model
return ['uuid'];
}
protected static function booted(): void
{
static::saving(function (Service $service) {
if ($service->type === null && $service->product_id) {
$service->type = Product::query()->where('id', $service->product_id)->value('product_type');
}
});
}
protected $table = 'services';
public const HOSTING_ACCOUNT_RELATIONS = [