refactor: Replace specific Hosting and VPS models and repositories with a generic Service repository and associated customer API endpoints.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user