Merge branch 'asif/contact' of gitlab.com:CIEFWorldwideSdnBhd/izyim-api into asif/contact

This commit is contained in:
Aqeeb Imtiaz Harun
2018-07-07 17:24:36 +08:00
19 changed files with 253 additions and 96 deletions
+11
View File
@@ -0,0 +1,11 @@
<?php
use Faker\Generator as Faker;
$factory->define(App\Contact::class, function (Faker $faker) {
return [
'user_id' => '1',
'com_id' => '1',
'status' => '1',
];
});
-9
View File
@@ -1,9 +0,0 @@
<?php
use Faker\Generator as Faker;
$factory->define(App\Warehouse::class, function (Faker $faker) {
return [
//
];
});
@@ -20,6 +20,7 @@ class AddForeignKeyToWarehousesTable extends Migration
->references('id')->on('warehouses')
->onDelete('cascade');
});
}
/**
@@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class DropComIdForWarehousesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('warehouses', function (Blueprint $table) {
$table->dropForeign(['com_id']);
$table->dropColumn('com_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('warehouses', function (Blueprint $table) {
//
});
}
}
@@ -0,0 +1,38 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ChangeReferenceIdForWarehousesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('warehouses', function (Blueprint $table) {
$table->unsignedInteger('com_id');//FK wrn id
$table->foreign('com_id')
->references('id')->on('companies')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('warehouses', function (Blueprint $table) {
//
});
}
}
+4 -2
View File
@@ -15,9 +15,11 @@ class CompanySeeder extends Seeder
DB::table('companies')->insert([
'id' => '999',
'company_profile'=>'testing',
'reg_cert'=>'12345',
'company_name'=>'testing',
'registration_no'=>'testing',
'tax_no'=>'testing',
'registration_no'=>'12345',
'tax_no'=>'12345',
'tel_no'=>'12345',
'fax'=>'12345',
'address'=>'testing',
+26
View File
@@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Seeder;
use Carbon\Carbon;
class ContactSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('contacts')->insert([
'id' => '999',
'user_id' => '2',
'com_id' => '999',
'status' => '1',
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
]);
}
}
+3 -1
View File
@@ -13,7 +13,9 @@ class DatabaseSeeder extends Seeder
{
$this->call(LaratrustSeeder::class);
$this->call(UsersTableSeeder::class);
$this->call(DeliveryInfoSeeder::class);
$this->call(CompanySeeder::class);
$this->call(DeliveryInfoSeeder::class);
$this->call(WarehouseSeeder::class);
$this->call(ContactSeeder::class);
}
}
+7 -7
View File
@@ -15,14 +15,14 @@ class DeliveryInfoSeeder extends Seeder
DB::table('deliveryinfos')->insert([
'id' => '999',
'branch' => 'Testing',
'deli_info' => 'Testing',
'address' => 'Testing',
'city' => 'Test',
'branch' => 'testing',
'deli_info' => 'testing',
'address' => 'testing',
'city' => 'testing',
'postcode' => '12345',
'state' => 'Testing',
'country' => 'Testing',
'contact_person' => 'Testing',
'state' => 'testing',
'country' => 'testing',
'contact_person' => 'testing',
'contact_person_no' => '12345',
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
+32
View File
@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Seeder;
use Carbon\Carbon;
class WarehouseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('warehouses')->insert([
'id' => '999',
'address'=>'testing',
'city'=>'testing',
'zip'=>'12345',
'state'=>'testing',
'contact_person'=>'testing',
'contact_person_no'=>'12345',
'branch'=>'testing',
'country'=>'testing',
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
'com_id' => '999'
]);
}
}