mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-19 04:23:59 +00:00
bulk commit
This commit is contained in:
@@ -7,8 +7,8 @@ use Faker\Generator as Faker;
|
||||
$factory->define(App\Models\Company::class, function (Faker $faker) {
|
||||
|
||||
return [
|
||||
'reference_no' => $faker->numerify('##########'),
|
||||
'reference_no' => $faker->numerify('#########'),
|
||||
'name' => $faker->company.' '.$faker->companySuffix,
|
||||
'type' => $faker->randomDigitNotNull
|
||||
'type' => $faker->randomDigitNotNull,
|
||||
];
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Classes\ValueObjects\Constants\Roles;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@@ -19,7 +20,7 @@ class CreateUsersTable extends Migration
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->smallInteger('role_id');
|
||||
$table->smallInteger('role_id')->default(Roles::USER);
|
||||
$table->boolean('active')->default(true);
|
||||
$table->rememberToken();
|
||||
$table->softDeletes();
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateUserEmailVerificationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('user_email_verifications', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('email', 100);
|
||||
$table->string('token', 32);
|
||||
$table->boolean('is_complete')->default(false);
|
||||
$table->boolean('is_active');
|
||||
$table->boolean('is_sent')->default(false);
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('email')->references('email')->on('users');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('user_email_verifications');
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Classes\ValueObjects\Constants\AccountStatus;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
@@ -18,8 +19,8 @@ class CreateCompaniesTable extends Migration
|
||||
$table->id();
|
||||
$table->bigInteger('reference_no')->unique();
|
||||
$table->string('name');
|
||||
$table->integer('type');
|
||||
$table->integer('status')->default(0);
|
||||
$table->integer('type')->comment('business type eg. personal, company');
|
||||
$table->integer('status')->default(AccountStatus::PENDING_VERIFICATION);
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ModuleTypes;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateCompanyModulesTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('company_modules', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('company_id');
|
||||
$table->integer('module_type')->default(ModuleTypes::IMPORTER);
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->foreign('company_id')->references('id')->on('companies');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('company_modules');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use App\Classes\ValueObjects\Constants\RelationStatus;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateCompanyConnectionsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('company_connections', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('module_one');
|
||||
$table->foreignId('module_two');
|
||||
$table->integer('status')->default(RelationStatus::PENDING);
|
||||
$table->foreignId('instigator')->comment('entity that is responsible for current status');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->foreign('module_one')->references('id')->on('company_modules');
|
||||
$table->foreign('module_two')->references('id')->on('company_modules');
|
||||
|
||||
$table->foreign('instigator')->references('id')->on('company_modules');
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('company_connections');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateCompanyEmployeesTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('company_employees', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('module_id');
|
||||
$table->foreignId('user_id');
|
||||
$table->integer('role_id');
|
||||
$table->boolean('active');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
$table->foreign('module_id')->references('id')->on('company_modules');
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('company_employees');
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateOrderTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('order', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('company_id');
|
||||
$table->string('marking')->unique();
|
||||
$table->foreignId('forwarder_id');
|
||||
$table->foreignId('address_id');
|
||||
$table->string('current_step')->nullable();
|
||||
$table->boolean('multiple_batch')->default(0);
|
||||
$table->boolean('complete')->default(0);
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('company_id')->references('id')->on('companies');
|
||||
$table->foreign('forwarder_id')->references('id')->on('companies');
|
||||
$table->foreign('address_id')->references('id')->on('addresses');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('order');
|
||||
}
|
||||
}
|
||||
@@ -16,18 +16,20 @@ class CreateOrdersTable extends Migration
|
||||
Schema::create('orders', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('company_id');
|
||||
$table->string('marking')->unique();
|
||||
$table->string('order_number')->unique();
|
||||
$table->foreignId('forwarder_id');
|
||||
$table->foreignId('address_id');
|
||||
$table->foreignId('contact_id');
|
||||
$table->string('current_step')->nullable();
|
||||
$table->boolean('multiple_batch')->default(0);
|
||||
$table->boolean('complete')->default(0);
|
||||
$table->boolean('multiple_batch')->default(false);
|
||||
$table->boolean('complete')->default(false);
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('company_id')->references('id')->on('companies');
|
||||
$table->foreign('forwarder_id')->references('id')->on('companies');
|
||||
$table->foreign('address_id')->references('id')->on('addresses');
|
||||
$table->foreign('contact_id')->references('id')->on('contacts');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ class AddressesTableSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
factory(App\Models\Address::class, 30)->create();
|
||||
if (app()->environment('local'))
|
||||
factory(App\Models\Address::class, 30)->create();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
use App\Classes\ValueObjects\Constants\AccountStatus;
|
||||
use App\Classes\ValueObjects\Constants\CompanyTypes;
|
||||
use App\Classes\ValueObjects\Constants\ModuleTypes;
|
||||
use App\Models\Company;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class CompaniesTableSeeder extends Seeder
|
||||
@@ -11,6 +15,18 @@ class CompaniesTableSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
factory(App\Models\Company::class, 30)->create();
|
||||
|
||||
$company = new Company();
|
||||
$company->reference_no = 1000000000;
|
||||
$company->name = 'CIEF Worldwide SDN BHD';
|
||||
$company->type = CompanyTypes::COMPANY_BUSINESS;
|
||||
$company->status = AccountStatus::ACTIVE;
|
||||
$company->save();
|
||||
|
||||
$company->modules()->create(['module_type' => ModuleTypes::FORWARDER]);
|
||||
|
||||
|
||||
// if (app()->environment('local'))
|
||||
// factory(App\Models\Company::class, 30)->create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ class ContactsTableSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
factory(App\Models\Contact::class, 30)->create();
|
||||
if (app()->environment('local'))
|
||||
factory(App\Models\Contact::class, 30)->create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,18 +24,10 @@ class UsersTableSeeder extends Seeder
|
||||
'role_id' => Roles::SUPER_ADMIN,
|
||||
'created_at' => \Carbon\Carbon::now(),
|
||||
'updated_at' => \Carbon\Carbon::now()
|
||||
],
|
||||
[
|
||||
'name' => 'Development User',
|
||||
'email' => env('EMAIL_DEVELOPMENT', 'dev@izyim.com'),
|
||||
'password' => Hash::make('123456abcabc'),
|
||||
'email_verified_at' => \Carbon\Carbon::now(),
|
||||
'role_id' => Roles::ADMIN,
|
||||
'created_at' => \Carbon\Carbon::now(),
|
||||
'updated_at' => \Carbon\Carbon::now()
|
||||
]
|
||||
]);
|
||||
|
||||
factory(App\Models\User::class, 30)->create();
|
||||
if (app()->environment('local'))
|
||||
factory(App\Models\User::class, 30)->create();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user