feat: Implement order and invoice management, enhance addon features, and remove the 'Type' module.
This commit is contained in:
@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -13,15 +12,18 @@ return new class extends Migration
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('product_addon',function (Blueprint $table){
|
||||
$table->id()->autoIncrement();
|
||||
$table->string('name',100)->nullable();
|
||||
$table->integer('price')->nullable();
|
||||
$table->integer('min')->nullable();
|
||||
$table->integer('max')->nullable();
|
||||
$table->integer('step')->nullable();
|
||||
$table->string('prefix',50)->nullable();
|
||||
$table->integer('type_id')->default(0)->index();
|
||||
Schema::create('product_addon', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('code', 50)->unique();
|
||||
$table->string('name', 100);
|
||||
$table->string('prefix', 50)->nullable();
|
||||
$table->integer('min')->default(0);
|
||||
$table->integer('max')->default(0);
|
||||
$table->integer('step')->default(1);
|
||||
$table->integer('price')->default(0);
|
||||
$table->enum('input_type', ['number', 'slider', 'select'])
|
||||
->default('number');
|
||||
$table->boolean('status')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
@@ -33,9 +35,6 @@ return new class extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('addon',function (Blueprint $table) {
|
||||
$table->dropForeign('group_id');
|
||||
$table->drop();
|
||||
});
|
||||
Schema::dropIfExists('product_addon');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -15,18 +15,6 @@ return new class extends Migration {
|
||||
//
|
||||
Schema::create('invoice_item', function (Blueprint $table) {
|
||||
$table->id()->autoIncrement();
|
||||
// $table->bigInteger('invoice_id')->default(0)->index();
|
||||
// $table->bigInteger('customer_id')->default(0)->index();
|
||||
// $table->tinyInteger('type_id')->default(0)->index();
|
||||
// $table->integer('product_id')->nullable();
|
||||
// $table->integer('billing')->nullable();
|
||||
// $table->integer('parent_id')->nullable();
|
||||
// $table->integer('relid')->nullable();
|
||||
// $table->text('description')->nullable();
|
||||
// $table->integer('amount')->nullable();
|
||||
// $table->integer('tax')->default(1);
|
||||
// $table->integer('due_date');
|
||||
|
||||
$table->bigInteger('invoice_id')->default(0)->index();
|
||||
$table->unsignedBigInteger('product_id')->nullable()->index();
|
||||
$table->integer('months')->default(0);
|
||||
|
||||
@@ -2,47 +2,46 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\Addon;
|
||||
|
||||
class AddonSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
public function run(): void
|
||||
{
|
||||
$productAddon = [
|
||||
$addons = [
|
||||
[
|
||||
'code' => 'cpu',
|
||||
'name' => 'CPU',
|
||||
'price' => 100000,
|
||||
'type_id' => 1,
|
||||
'min' => 0,
|
||||
'max' => 30,
|
||||
'step' => 1,
|
||||
'prefix' => 'vCore'
|
||||
'prefix' => 'vCore',
|
||||
'status' => true,
|
||||
],
|
||||
[
|
||||
'code' => 'ram',
|
||||
'name' => 'RAM',
|
||||
'price' => 50000,
|
||||
'type_id' => 1,
|
||||
'min' => 0,
|
||||
'max' => 32,
|
||||
'step' => 1,
|
||||
'prefix' => 'GB'
|
||||
'prefix' => 'GB',
|
||||
'status' => true,
|
||||
],
|
||||
[
|
||||
'code' => 'disk',
|
||||
'name' => 'SSD',
|
||||
'price' => 4000,
|
||||
'type_id' => 1,
|
||||
'min' => 0,
|
||||
'max' => 1500,
|
||||
'step' => 10,
|
||||
'prefix' => 'GB'
|
||||
]
|
||||
'prefix' => 'GB',
|
||||
'status' => true,
|
||||
],
|
||||
];
|
||||
\App\Models\Addon::insert($productAddon);
|
||||
|
||||
Addon::upsert($addons, ['code']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ class DatabaseSeeder extends Seeder
|
||||
public function run(): void
|
||||
{
|
||||
User::factory(1)->create();
|
||||
$this->call(TypeSeeder::class);
|
||||
|
||||
$this->call(DomainTypeSeeder::class);
|
||||
$this->call(GroupSeeder::class);
|
||||
$this->call(Payment::class);
|
||||
@@ -30,5 +30,6 @@ class DatabaseSeeder extends Seeder
|
||||
$this->call(Setting::class);
|
||||
$this->call(MenuSeeder::class);
|
||||
$this->call(ControlPanelSeeder::class);
|
||||
$this->call(VcenterSeeder::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Type;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class TypeSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$group = [
|
||||
[
|
||||
'name' => 'Addon',
|
||||
'status' => 1,
|
||||
'icon' => ''
|
||||
],
|
||||
[
|
||||
'name' => 'Domain',
|
||||
'status' => 1,
|
||||
'icon' => 'file/domain.svg'
|
||||
],
|
||||
[
|
||||
'name' => 'Hosting',
|
||||
'status' => 1,
|
||||
'icon' => 'file/hosting.svg'
|
||||
],
|
||||
[
|
||||
'name' => 'VPS',
|
||||
'status' => 1,
|
||||
'icon' => 'file/vps.svg'
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($group as $item) {
|
||||
Type::create($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\vCenter;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class VcenterSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// vCenter::create([
|
||||
// 'host' => '10.10.10.6',
|
||||
// 'user' => 'administrator@vsphere.local',
|
||||
// 'password' => bcrypt('Tgs@1238989$%^'),
|
||||
// 'status' => 1
|
||||
// ]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user