mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/unity.git
synced 2026-08-19 04:13:58 +00:00
vendor machine seeder
This commit is contained in:
@@ -17,6 +17,7 @@ class CreateEntitiesTable extends Migration
|
||||
$table->id();
|
||||
$table->bigInteger('user_id')->unsigned()->nullable();
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->string('name')->nullable();
|
||||
$table->integer('status')->nullable()->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
+4
-2
@@ -19,12 +19,14 @@ class CreateContractTemplateObligationsTable extends Migration
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->bigInteger('contract_template_id')->unsigned()->nullable();
|
||||
$table->foreign('contract_template_id')->references('id')->on('contract_templates')->onDelete('cascade');
|
||||
$table->string('name')->nullable();
|
||||
$table->float('sequence', 4, 2)->nullable();
|
||||
$table->string('reference');
|
||||
$table->json('content');
|
||||
$table->string('reference')->nullable();
|
||||
$table->json('content')->nullable();
|
||||
$table->integer('must_complete')->nullable()->default(1);
|
||||
$table->integer('must_accept')->nullable()->default(1);
|
||||
$table->integer('complete_day_range')->nullable()->default(1);
|
||||
$table->integer('type')->nullable()->default(1);
|
||||
$table->integer('status')->nullable()->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@ class CreateContractsTable extends Migration
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->bigInteger('contract_template_id')->unsigned()->nullable();
|
||||
$table->foreign('contract_template_id')->references('id')->on('contract_templates')->onDelete('cascade');
|
||||
$table->string('name');
|
||||
$table->string('name')->nullable();
|
||||
$table->json('in_time_contract_template');
|
||||
$table->integer('status')->nullable()->default(1);
|
||||
$table->timestamp('completed_at')->nullable();
|
||||
|
||||
@@ -21,8 +21,9 @@ class CreateContractObligationsTable extends Migration
|
||||
$table->foreign('contract_id')->references('id')->on('contracts')->onDelete('cascade');
|
||||
$table->bigInteger('contract_entity_id')->unsigned()->nullable();
|
||||
$table->foreign('contract_entity_id')->references('id')->on('contract_entities')->onDelete('cascade');
|
||||
$table->string('reference');
|
||||
$table->json('content');
|
||||
$table->string('name')->nullable();
|
||||
$table->string('reference')->nullable();
|
||||
$table->json('content')->nullable();
|
||||
$table->integer('must_complete')->nullable()->default(1);
|
||||
$table->integer('must_accept')->nullable()->default(1);
|
||||
$table->integer('complete_status')->nullable()->default(1);
|
||||
|
||||
@@ -22,7 +22,18 @@ class DatabaseSeeder extends Seeder
|
||||
|
||||
// User
|
||||
$this->call(UsersTableSeeder::class);
|
||||
|
||||
|
||||
// Soda Vendor Machine
|
||||
$this->call(SodaVendorMachine\SodaVendorContractTemplatesTableSeeder::class);
|
||||
$this->call(SodaVendorMachine\SodaVendorContractTemplateObligationsTableSeeder::class);
|
||||
$this->call(SodaVendorMachine\SodaVendorContractTemplateObligationDependenciesTableSeeder::class);
|
||||
$this->call(SodaVendorMachine\SodaVendorEntitiesTableSeeder::class);
|
||||
$this->call(SodaVendorMachine\SodaVendorEntitySignaturesTableSeeder::class);
|
||||
$this->call(SodaVendorMachine\SodaVendorContractsTableSeeder::class);
|
||||
$this->call(SodaVendorMachine\SodaVendorContractEntitiesTableSeeder::class);
|
||||
$this->call(SodaVendorMachine\SodaVendorContractObligationsTableSeeder::class);
|
||||
$this->call(SodaVendorMachine\SodaVendorContractObligationDependenciesTableSeeder::class);
|
||||
|
||||
DB::commit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders\SodaVendorMachine;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class SodaVendorContractEntitiesTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('contract_entities')->insert([
|
||||
[
|
||||
'id' => 1,
|
||||
'user_id' => 2,
|
||||
'contract_id' => 1,
|
||||
'entity_id' => 1,
|
||||
'entity_signature_id' => 1,
|
||||
'type' => 1,
|
||||
'status' => 1,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
],
|
||||
[
|
||||
'id' => 2,
|
||||
'user_id' => 2,
|
||||
'contract_id' => 1,
|
||||
'entity_id' => 2,
|
||||
'entity_signature_id' => 2,
|
||||
'type' => 1,
|
||||
'status' => 1,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders\SodaVendorMachine;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class SodaVendorContractObligationDependenciesTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('contract_obligation_dependencies')->insert([
|
||||
[
|
||||
'id' => 1,
|
||||
'user_id' => 2,
|
||||
'contract_obligation_id' => 2, // vendor machine drop selected soda to user
|
||||
'depend_contract_obligation_id' => 1, // user insert coin and select soda at vendor machine
|
||||
'status' => 1,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
],
|
||||
[
|
||||
'id' => 2,
|
||||
'user_id' => 2,
|
||||
'contract_obligation_id' => 3, // user pickup the soda
|
||||
'depend_contract_obligation_id' => 2, // vendor machine drop selected soda to user
|
||||
'status' => 1,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders\SodaVendorMachine;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class SodaVendorContractObligationsTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('contract_obligations')->insert([
|
||||
[
|
||||
'id' => 1,
|
||||
'user_id' => 2,
|
||||
'contract_id' => 1,
|
||||
'contract_entity_id' => 1,
|
||||
'name' => 'user insert coin and select soda at vendor machine',
|
||||
'reference' => null,
|
||||
'content' => null,
|
||||
'must_complete' => 1,
|
||||
'must_accept' => 1,
|
||||
'complete_status' => config('constants.contract_obligation.complete_status.pending'),
|
||||
'accept_status' => config('constants.contract_obligation.accept_status.pending'),
|
||||
'type' => config('constants.contract_obligation.type.money'),
|
||||
'status' => 1,
|
||||
'completed_at' => null,
|
||||
'failed_at' => null,
|
||||
'start_at' => Carbon::now(),
|
||||
'end_at' => Carbon::now()->addDays(1),
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
],
|
||||
[
|
||||
'id' => 2,
|
||||
'user_id' => 2,
|
||||
'contract_id' => 1,
|
||||
'contract_entity_id' => 2,
|
||||
'name' => 'vendor machine drop selected soda to user',
|
||||
'reference' => null,
|
||||
'content' => null,
|
||||
'must_complete' => 1,
|
||||
'must_accept' => 1,
|
||||
'complete_status' => config('constants.contract_obligation.complete_status.pending'),
|
||||
'accept_status' => config('constants.contract_obligation.accept_status.pending'),
|
||||
'type' => config('constants.contract_obligation.type.offer_service'),
|
||||
'status' => 1,
|
||||
'completed_at' => null,
|
||||
'failed_at' => null,
|
||||
'start_at' => null,
|
||||
'end_at' => null,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
],
|
||||
[
|
||||
'id' => 3,
|
||||
'user_id' => 2,
|
||||
'contract_id' => 1,
|
||||
'contract_entity_id' => 2,
|
||||
'name' => 'user pickup the soda',
|
||||
'reference' => null,
|
||||
'content' => null,
|
||||
'must_complete' => 1,
|
||||
'must_accept' => 1,
|
||||
'complete_status' => config('constants.contract_obligation.complete_status.pending'),
|
||||
'accept_status' => config('constants.contract_obligation.accept_status.pending'),
|
||||
'type' => config('constants.contract_obligation.type.offer_service'),
|
||||
'status' => 1,
|
||||
'completed_at' => Carbon::now(),
|
||||
'failed_at' => null,
|
||||
'start_at' => null,
|
||||
'end_at' => null,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders\SodaVendorMachine;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class SodaVendorContractTemplateObligationDependenciesTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('contract_template_obligation_dependencies')->insert([
|
||||
[
|
||||
'id' => 1,
|
||||
'user_id' => 2,
|
||||
'contract_template_obligation_id' => 2, // vendor machine drop selected soda to user
|
||||
'depend_template_contract_obligation_id' => 1, // user insert coin and select soda at vendor machine
|
||||
'status' => 1,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
],
|
||||
[
|
||||
'id' => 2,
|
||||
'user_id' => 2,
|
||||
'contract_template_obligation_id' => 3, // user pickup the soda
|
||||
'depend_template_contract_obligation_id' => 2, // vendor machine drop selected soda to user
|
||||
'status' => 1,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders\SodaVendorMachine;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class SodaVendorContractTemplateObligationsTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('contract_template_obligations')->insert([
|
||||
[
|
||||
'id' => 1,
|
||||
'user_id' => 2,
|
||||
'contract_template_id' => 1,
|
||||
'name' => 'user insert coin and select soda at vendor machine',
|
||||
'sequence' => 1.0,
|
||||
'reference' => null,
|
||||
'content' => null,
|
||||
'must_complete' => 1,
|
||||
'must_accept' => 1,
|
||||
'complete_day_range' => 1,
|
||||
'type' => config('constants.contract_obligation.type.money'),
|
||||
'status' => 1,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
],
|
||||
[
|
||||
'id' => 2,
|
||||
'user_id' => 2,
|
||||
'contract_template_id' => 1,
|
||||
'name' => 'vendor machine drop selected soda to user',
|
||||
'sequence' => 2.0,
|
||||
'reference' => null,
|
||||
'content' => null,
|
||||
'must_complete' => 1,
|
||||
'must_accept' => 1,
|
||||
'complete_day_range' => 1,
|
||||
'type' => config('constants.contract_obligation.type.offer_service'),
|
||||
'status' => 1,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
],
|
||||
[
|
||||
'id' => 3,
|
||||
'user_id' => 2,
|
||||
'contract_template_id' => 1,
|
||||
'name' => 'user pickup the soda',
|
||||
'sequence' => 3.0,
|
||||
'reference' => null,
|
||||
'content' => null,
|
||||
'must_complete' => 1,
|
||||
'must_accept' => 1,
|
||||
'complete_day_range' => 1,
|
||||
'type' => config('constants.contract_obligation.type.received_service'),
|
||||
'status' => 1,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders\SodaVendorMachine;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class SodaVendorContractTemplatesTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('contract_templates')->insert([
|
||||
[
|
||||
'id' => 1,
|
||||
'user_id' => 2,
|
||||
'name' => 'Coca Cola Contract Service',
|
||||
'complete_day_range' => 1,
|
||||
'status' => 1,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders\SodaVendorMachine;
|
||||
|
||||
use App\Models\ContractTemplate;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class SodaVendorContractsTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$contract_template = ContractTemplate::find(1);
|
||||
|
||||
DB::table('contracts')->insert([
|
||||
[
|
||||
'id' => 1,
|
||||
'user_id' => $contract_template->user_id,
|
||||
'contract_template_id' => $contract_template->id,
|
||||
'name' => $contract_template->name,
|
||||
'in_time_contract_template' => json_encode($contract_template),
|
||||
'status' => 1,
|
||||
'completed_at' => null,
|
||||
'failed_at' => null,
|
||||
'start_at' => Carbon::now(),
|
||||
'end_at' => Carbon::now()->addDays($contract_template->complete_day_range),
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders\SodaVendorMachine;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class SodaVendorEntitiesTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('entities')->insert([
|
||||
[
|
||||
'id' => 1,
|
||||
'user_id' => 2,
|
||||
'name' => 'Fat Kid',
|
||||
'status' => 1,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
],
|
||||
[
|
||||
'id' => 2,
|
||||
'user_id' => 2,
|
||||
'name' => 'Coca Cola Vendor Machine',
|
||||
'status' => 1,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders\SodaVendorMachine;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class SodaVendorEntitySignaturesTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('entity_signatures')->insert([
|
||||
[
|
||||
'id' => 1,
|
||||
'entity_id' => 1,
|
||||
'type' => 1,
|
||||
'status' => 1,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
],
|
||||
[
|
||||
'id' => 2,
|
||||
'entity_id' => 2,
|
||||
'type' => 1,
|
||||
'status' => 1,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -32,10 +32,10 @@ class UsersTableSeeder extends Seeder
|
||||
],
|
||||
[
|
||||
'id' => 2,
|
||||
'first_name' => 'vendor machine',
|
||||
'last_name' => 'project',
|
||||
'username' => 'user 1',
|
||||
'email' => 'one@vendor-machine.com',
|
||||
'first_name' => 'Coca Cola',
|
||||
'last_name' => 'Project',
|
||||
'username' => 'cocal-cola',
|
||||
'email' => 'one@coca-cola.com',
|
||||
'password' => bcrypt('pass123'),
|
||||
'img' => null,
|
||||
'status' => 1,
|
||||
|
||||
Reference in New Issue
Block a user