refactor: Replace specific Hosting and VPS models and repositories with a generic Service repository and associated customer API endpoints.

This commit is contained in:
pbao9
2026-03-13 07:50:35 +07:00
parent dbd3cdafcd
commit a388eabe17
12 changed files with 82 additions and 347 deletions
-40
View File
@@ -1,40 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Hosting extends Model
{
use HasFactory;
protected $table = 'hosting';
protected $fillable = [
'name',
'price',
'price_sale',
'description',
'template',
'group_id',
'type_id',
'status',
'disk',
'ram',
'bandwidth',
'cpu',
'gpu',
'ip'
];
public function type()
{
return $this->belongsTo(\App\Models\Type::class);
}
public function group()
{
return $this->belongsTo(\App\Models\Group::class);
}
}
-55
View File
@@ -1,55 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class VPS extends Model
{
use HasFactory;
protected $table = 'vps';
protected $fillable = [
'name',
'cpu',
'ram',
'disk',
'gpu',
'description',
'bandwidth',
'price',
'price_sale',
'module_host_id',
'template_id',
'type_id',
'group_id',
'status'
];
public function type()
{
return $this->belongsTo(\App\Models\Type::class);
}
public function host()
{
return $this->belongsTo(\App\Models\ModuleHost::class, 'module_host_id', 'id');
}
public function group()
{
return $this->belongsTo(\App\Models\Group::class);
}
/**
* Many-to-many relationship với OS.
*/
public function operatingSystems()
{
return $this->belongsToMany(\App\Models\Os::class, 'product_os', 'product_id', 'os_id')
->withTimestamps()
->withPivot('product_type');
}
}