update
This commit is contained in:
parent
c8f71adc64
commit
3ec7509361
@ -1,65 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Invoice;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Invoice\Item;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ItemController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Invoice\Item $item
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Item $item)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Models\Invoice\Item $item
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Item $item)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Invoice\Item $item
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Item $item)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Invoice;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Invoice\Transaction;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TransactionController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Invoice\Transaction $transaction
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Transaction $transaction)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Models\Invoice\Transaction $transaction
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Transaction $transaction)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Invoice\Transaction $transaction
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Transaction $transaction)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Product;
|
||||
namespace App\Http\Controllers\Remote;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ProductController extends Controller
|
||||
class ServerController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
@ -25,7 +25,7 @@ public function index()
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
// 远程服务器汇报服务器状态
|
||||
}
|
||||
|
||||
/**
|
@ -1,12 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Invoice;
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Invoice\Invoice;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
class InvoiceController extends Controller
|
||||
class ServerController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
@ -15,7 +14,10 @@ class InvoiceController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
// get all servers from cache
|
||||
// $servers = Cache::remember('servers', now()->addMinutes(5), function () {
|
||||
// return \App\Models\Server::all();
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
@ -32,10 +34,10 @@ public function store(Request $request)
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Invoice\Invoice $invoice
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Invoice $invoice)
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
@ -44,10 +46,10 @@ public function show(Invoice $invoice)
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Models\Invoice\Invoice $invoice
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Invoice $invoice)
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
@ -55,10 +57,10 @@ public function update(Request $request, Invoice $invoice)
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Invoice\Invoice $invoice
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Invoice $invoice)
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
20
app/Models/Module/Module.php
Normal file
20
app/Models/Module/Module.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Module;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Module extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'modules';
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'short_name',
|
||||
'backend_url',
|
||||
'api_token',
|
||||
];
|
||||
}
|
11
app/Models/Module/Provider.php
Normal file
11
app/Models/Module/Provider.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Module;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Provider extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
46
app/Models/Module/ProviderModule.php
Normal file
46
app/Models/Module/ProviderModule.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Module;
|
||||
|
||||
use App\Models\Provider;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProviderModule extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'provider_modules';
|
||||
|
||||
protected $fillable = [
|
||||
'provider_id',
|
||||
'module_id',
|
||||
'is_enabled',
|
||||
];
|
||||
|
||||
public function provider()
|
||||
{
|
||||
return $this->belongsTo(Provider::class);
|
||||
}
|
||||
|
||||
public function module()
|
||||
{
|
||||
return $this->belongsTo(Module::class);
|
||||
}
|
||||
|
||||
public function getIsEnabledAttribute($value)
|
||||
{
|
||||
return (bool) $value;
|
||||
}
|
||||
|
||||
// before create
|
||||
// protected static function boot()
|
||||
// {
|
||||
// parent::boot();
|
||||
// static::creating(function ($model) {
|
||||
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Product;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ConfigurableOption extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'product_configurable_options';
|
||||
|
||||
protected $fillable = [
|
||||
'display_name',
|
||||
'name',
|
||||
'is_hidden',
|
||||
'type',
|
||||
'min_qty',
|
||||
'max_qty',
|
||||
'unit',
|
||||
'qty_step',
|
||||
'is_allow_degrade',
|
||||
'order',
|
||||
'notes',
|
||||
'group_id',
|
||||
];
|
||||
|
||||
public function group()
|
||||
{
|
||||
return $this->belongsTo(ConfigOptionGroup::class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Product;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ConfigurableOptionGroup extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'product_configurable_option_groups';
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'description',
|
||||
];
|
||||
|
||||
public function products()
|
||||
{
|
||||
return $this->belongsToMany(Product::class);
|
||||
}
|
||||
|
||||
public function configOptions()
|
||||
{
|
||||
return $this->hasMany(ConfigOption::class);
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Product;
|
||||
|
||||
use App\Models\Admin\Admin;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Group extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'product_groups';
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'slug',
|
||||
'title',
|
||||
'description',
|
||||
'is_hidden',
|
||||
'order',
|
||||
];
|
||||
|
||||
public function admin()
|
||||
{
|
||||
return $this->belongsTo(Admin::class);
|
||||
}
|
||||
|
||||
public function products()
|
||||
{
|
||||
return $this->hasMany(Product::class);
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Product;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Product extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'products';
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'slug',
|
||||
'description',
|
||||
'is_hidden',
|
||||
'product_group_id',
|
||||
'is_stock_control',
|
||||
'stock',
|
||||
'module',
|
||||
'server_group_id',
|
||||
'order',
|
||||
'price',
|
||||
'is_retired',
|
||||
'is_recommended',
|
||||
'setup_fee',
|
||||
'monthly_fee',
|
||||
'quarterly_fee',
|
||||
'half_yearly_fee',
|
||||
'yearly_fee',
|
||||
'hourly_fee',
|
||||
'configurable_option_group_id'
|
||||
];
|
||||
|
||||
public function productGroup()
|
||||
{
|
||||
return $this->belongsTo(ProductGroup::class);
|
||||
}
|
||||
|
||||
// public function configurableOptionGroup()
|
||||
// {
|
||||
// return $this->belongsTo(ConfigurableOptionGroup::class);
|
||||
// }
|
||||
|
||||
// public function configurableOptions()
|
||||
// {
|
||||
// return $this->hasMany(ConfigurableOption::class);
|
||||
// }
|
||||
|
||||
}
|
11
app/Models/User/Host.php
Normal file
11
app/Models/User/Host.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\User;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Host extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
13
app/Models/Workorder/Reply.php
Normal file
13
app/Models/Workorder/Reply.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Workorder;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Reply extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'workorder_replies';
|
||||
}
|
11
app/Models/Workorder/Workorder.php
Normal file
11
app/Models/Workorder/Workorder.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Workorder;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Workorder extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
@ -21,7 +21,7 @@ public function up()
|
||||
$table->string('password')->nullable();
|
||||
|
||||
// 积分(8位小数点)
|
||||
$table->decimal('drops', 8, 2)->default(0);
|
||||
$table->double('drops', 8, 6)->default(0);
|
||||
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
|
@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('product_groups', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->string('name')->nullable()->index();
|
||||
$table->string('slug')->nullable()->index();
|
||||
|
||||
// 标题
|
||||
$table->string('title')->nullable();
|
||||
|
||||
// 描述
|
||||
$table->string('description')->nullable();
|
||||
|
||||
// 是否隐藏
|
||||
$table->boolean('is_hidden')->default(false);
|
||||
|
||||
// 排序
|
||||
$table->integer('order')->default(0);
|
||||
|
||||
// 由哪个管理员创建
|
||||
// $table->unsignedBigInteger('admin_id')->nullable()->index();
|
||||
// $table->foreign('admin_id')->references('id')->on('admins');
|
||||
|
||||
$table->softDeletes();
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('product_groups');
|
||||
}
|
||||
};
|
@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('product_configurable_option_groups', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->string('name')->nullable()->index();
|
||||
$table->string('description')->nullable()->index();
|
||||
|
||||
// soft delete
|
||||
$table->softDeletes();
|
||||
|
||||
// 由哪个管理员创建
|
||||
// $table->unsignedBigInteger('admin_id')->nullable()->index();
|
||||
// $table->foreign('admin_id')->references('id')->on('admins');
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('config_option_groups');
|
||||
}
|
||||
};
|
@ -1,71 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('product_configurable_options', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// 显示名称
|
||||
$table->string('display_name')->nullable()->index();
|
||||
// 名称
|
||||
$table->string('name')->nullable()->index();
|
||||
|
||||
// 是否隐藏
|
||||
$table->boolean('is_hidden')->default(false);
|
||||
|
||||
// 类型(Dropdown 下拉菜单, Radio 单选按钮, Boolean 是否,Quantity 数量)),默认为Dropdown
|
||||
$table->string('type')->default('Dropdown');
|
||||
|
||||
// 最小数量
|
||||
$table->integer('min_qty')->default(0);
|
||||
// 最大数量
|
||||
$table->integer('max_qty')->default(0);
|
||||
|
||||
// 单位
|
||||
$table->string('unit')->nullable();
|
||||
|
||||
// 数量阶梯
|
||||
$table->string('qty_step')->nullable();
|
||||
|
||||
// 是否支持降级
|
||||
$table->boolean('is_allow_degrade')->default(false);
|
||||
|
||||
// 排序
|
||||
$table->integer('order')->default(0);
|
||||
|
||||
// 备注
|
||||
$table->string('notes')->nullable();
|
||||
|
||||
// 可配置选项组
|
||||
$table->unsignedBigInteger('group_id')->nullable()->index();
|
||||
$table->foreign('group_id')->references('id')->on('product_configurable_options');
|
||||
|
||||
// 由哪个管理员创建
|
||||
// $table->unsignedBigInteger('admin_id')->nullable()->index();
|
||||
// $table->foreign('admin_id')->references('id')->on('admins');
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('config_options');
|
||||
}
|
||||
};
|
@ -1,92 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('products', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->string('name')->nullable()->index();
|
||||
$table->string('slug')->nullable()->index();
|
||||
// 介绍
|
||||
$table->string('description')->nullable();
|
||||
// 是否隐藏
|
||||
$table->boolean('is_hidden')->default(false);
|
||||
|
||||
// 产品组
|
||||
$table->unsignedBigInteger('product_group_id')->nullable()->index();
|
||||
$table->foreign('product_group_id')->references('id')->on('product_groups')->onDelete('set null');
|
||||
|
||||
// 库存控制
|
||||
$table->boolean('is_stock_control')->default(false);
|
||||
|
||||
// 库存
|
||||
$table->integer('stock')->default(0);
|
||||
|
||||
// 服务器模块
|
||||
$table->string('module')->nullable()->index();
|
||||
|
||||
// 排序
|
||||
$table->integer('order')->default(0);
|
||||
|
||||
// 价格
|
||||
$table->decimal('price', 10, 2)->default(0);
|
||||
|
||||
// 是否下架
|
||||
$table->boolean('is_retired')->default(false);
|
||||
|
||||
// 是否推荐
|
||||
$table->boolean('is_recommended')->default(false);
|
||||
|
||||
/* 价格部分 */
|
||||
// 设置费
|
||||
$table->decimal('setup_fee', 10, 2)->default(0);
|
||||
|
||||
// 每月付费
|
||||
$table->decimal('monthly_fee', 10, 2)->default(0);
|
||||
|
||||
// 季度
|
||||
$table->decimal('quarterly_fee', 10, 2)->default(0);
|
||||
|
||||
// 半年付费
|
||||
$table->decimal('half_yearly_fee', 10, 2)->default(0);
|
||||
|
||||
// 年付费
|
||||
$table->decimal('yearly_fee', 10, 2)->default(0);
|
||||
|
||||
// 小时付费
|
||||
$table->decimal('hourly_fee', 10, 2)->default(0);
|
||||
|
||||
// 可配置选项组 ID
|
||||
$table->unsignedBigInteger('product_configurable_option_group_id')->nullable()->index();
|
||||
$table->foreign('product_configurable_option_group_id')->references('id')->on('product_configurable_options');
|
||||
|
||||
// 由哪个管理员创建
|
||||
// $table->unsignedBigInteger('admin_id')->nullable()->index();
|
||||
// $table->foreign('admin_id')->references('id')->on('admins');
|
||||
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('products');
|
||||
}
|
||||
};
|
@ -27,7 +27,7 @@ public function up()
|
||||
$table->integer('rate')->default(1);
|
||||
|
||||
// 实际收入
|
||||
$table->decimal('total', 8, 2)->default(1);
|
||||
$table->double('total', 8, 6)->default(0);
|
||||
|
||||
$table->boolean('status')->default(0)->index();
|
||||
|
||||
|
@ -27,7 +27,7 @@ public function up()
|
||||
$table->string('payment')->index();
|
||||
|
||||
// amount
|
||||
$table->decimal('amount', 8, 2)->default(0);
|
||||
$table->double('amount', 8, 6)->default(0);
|
||||
|
||||
|
||||
$table->timestamps();
|
||||
|
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('modules', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// name
|
||||
$table->string('name')->index();
|
||||
|
||||
// type
|
||||
$table->string('type')->index();
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('modules');
|
||||
}
|
||||
};
|
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('providers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// name
|
||||
$table->string('name')->index();
|
||||
|
||||
// api_token
|
||||
$table->string('api_token')->index()->unique();
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('providers');
|
||||
}
|
||||
};
|
56
database/migrations/2022_08_13_051148_create_hosts_table.php
Normal file
56
database/migrations/2022_08_13_051148_create_hosts_table.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Module\ProviderModule;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('hosts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// name
|
||||
$table->string('name')->index();
|
||||
|
||||
// provider id
|
||||
$table->foreignIdFor(ProviderModule::class)->index();
|
||||
|
||||
// user_id
|
||||
$table->foreignIdFor(User::class)->index();
|
||||
|
||||
// price
|
||||
$table->double('price', 8, 6)->index();
|
||||
|
||||
// config
|
||||
$table->json('configuration')->nullable();
|
||||
|
||||
// status
|
||||
$table->enum('status', ['running', 'stopped', 'error', 'suspended', 'pending'])->default('pending')->index();
|
||||
|
||||
// soft delete
|
||||
$table->softDeletes();
|
||||
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('hosts');
|
||||
}
|
||||
};
|
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Module\Module;
|
||||
use App\Models\Module\ProviderModule;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('workorders', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// title
|
||||
$table->string('title')->index();
|
||||
|
||||
// content
|
||||
$table->text('content')->nullable();
|
||||
|
||||
// host id (optional) and null on delete
|
||||
$table->foreignIdFor(Module::class)->nullable()->onDelete('set null');
|
||||
|
||||
// user id
|
||||
$table->foreignIdFor(User::class)->index();
|
||||
|
||||
// provider id
|
||||
$table->foreignIdFor(ProviderModule::class)->index()->onDelete('set null');
|
||||
|
||||
// status
|
||||
$table->enum('status', ['open', 'closed', 'user_replied', 'replied', 'on_hold', 'in_progress', 'error', 'pending'])->default('pending')->index();
|
||||
|
||||
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('workorders');
|
||||
}
|
||||
};
|
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Workorder\Workorder;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('workorder_replies', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// workorder id (on delete cascade)
|
||||
$table->foreignIdFor(Workorder::class)->index()->onDelete('cascade');
|
||||
|
||||
// user id
|
||||
$table->foreignIdFor(User::class)->index();
|
||||
|
||||
|
||||
$table->boolean('is_pending')->default(false)->index();
|
||||
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('workorder_replies');
|
||||
}
|
||||
};
|
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Module\Module;
|
||||
use App\Models\Module\Provider;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('provider_modules', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// provider id (on delete cascade)
|
||||
$table->foreignIdFor(Provider::class)->index()->onDelete('cascade');
|
||||
|
||||
// module id
|
||||
$table->foreignIdFor(Module::class)->index();
|
||||
|
||||
// backend url
|
||||
$table->string('backend_url')->nullable();
|
||||
|
||||
// enabled
|
||||
$table->boolean('is_enabled')->default(false)->index();
|
||||
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('provider_modules');
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user