Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/izyim-api into zain/shipping-order

# Conflicts:
#	Dockerfile
#	app/Http/Controllers/AuthController.php
#	app/User.php
#	database/factories/UserFactory.php
#	database/migrations/2018_04_25_084609_change_email_to_mobile_from_user.php
#	database/seeds/DatabaseSeeder.php
#	public/home.html
#	public/index.html
#	public/profile-first-setup.html
#	public/verify-code-number.html
#	public/verify-phone-number.html
#	routes/api.php
#	routes/web.php
#	tests/Feature/LoginTest.php
#	tests/Feature/RegisterTest.php
This commit is contained in:
Jack Goh
2018-06-28 16:58:01 +08:00
49 changed files with 15458 additions and 263 deletions
+30
View File
@@ -0,0 +1,30 @@
<?php
use Faker\Generator as Faker;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/
// Manually creating the relationship tree.
$factory->define(App\Company::class, function (Faker $faker) {
return [
'company_name'=>'testing',
'registration_no'=>'testing',
'tax_no'=>'testing',
'tel_no'=>'12345',
'fax'=>'12345',
'address'=>'testing',
'city'=>'testing',
'postcode'=>'testing',
'state'=>'testing',
'country'=>'testing',
'contact_person'=>'testing'
];
});
+3
View File
@@ -15,6 +15,9 @@ use Faker\Generator as Faker;
$factory->define(App\User::class, function (Faker $faker) {
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'password' => bcrypt(str_random(10)), // secret
'phone' => $faker->unique()->randomDigit,
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
'remember_token' => str_random(10),
@@ -0,0 +1,44 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCompaniesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('companies', function (Blueprint $table) {
$table->increments('id');
$table->string('company_profile');//->default('default.jpg'); //need to check about storage type
$table->string('reg_cert');
$table->string('company-name');
$table->string('registration-no');
$table->string('tax-no');
$table->integer('tel-no');
$table->integer('fax');
$table->string('address');
$table->string('city');
$table->string('postcode');
$table->string('state');
$table->string('country');
$table->string('contact-person');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('companies');
}
}
@@ -0,0 +1,43 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateDeliveryinfosTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('deliveryinfos', function (Blueprint $table) {
$table->increments('id');
$table->string('branch');
$table->string('deli_info');
$table->string('address');
$table->string('city');
$table->integer('postcode');
$table->string('state');
$table->string('country');
$table->string('contact_person');
$table->integer('contact_person_no');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('deliveryinfos');
}
}
@@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RenameColumnInCompany extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('companies', function (Blueprint $table) {
// $table->renameColumn('company-profile', 'company_profile');
$table->renameColumn('"company-name"', 'company_name');
$table->renameColumn('"registration-no"', 'registration_no');
$table->renameColumn('"tax-no"', 'tax_no');
$table->renameColumn('"tel-no"', 'tel_no');
$table->renameColumn('"contact-person"', 'contact_person');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -25,6 +25,6 @@ class ChangeEmailToMobileFromUser extends Migration
*/
public function down()
{
$table->renameColumn('phone', 'email');
//$table->renameColumn('phone', 'email');
}
}
@@ -0,0 +1,45 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddNullableToCompanies extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('companies', function (Blueprint $table) {
//
$table->string('company_profile')->nullable()->change(); //need to check about storage type
$table->string('reg_cert')->nullable()->change();
$table->string('company_name')->nullable()->change();
$table->string('registration_no')->nullable()->change();
$table->string('tax_no')->nullable()->change();
$table->integer('tel_no')->nullable()->change();
$table->integer('fax')->nullable()->change();
$table->string('address')->nullable()->change();
$table->string('city')->nullable()->change();
$table->string('postcode')->nullable()->change();
$table->string('state')->nullable()->change();
$table->string('country')->nullable()->change();
$table->string('contact_person')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('companies', function (Blueprint $table) {
//
});
}
}
@@ -0,0 +1,31 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddUserToCompanyTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('companies', function (Blueprint $table) {
$table->unsignedInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,37 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddColumnToTableDeliveryInfo extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('deliveryinfos', 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('deliveryinfos', function (Blueprint $table) {
//
});
}
}
+35
View File
@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Seeder;
use Carbon\Carbon;
class CompanySeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('companies')->insert([
'id' => '999',
'company_name'=>'testing',
'registration_no'=>'testing',
'tax_no'=>'testing',
'tel_no'=>'12345',
'fax'=>'12345',
'address'=>'testing',
'city'=>'testing',
'postcode'=>'12345',
'state'=>'testing',
'country'=>'testing',
'contact_person'=>'testing',
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
'user_id' => '2'
]);
}
}
+2
View File
@@ -14,5 +14,7 @@ class DatabaseSeeder extends Seeder
$this->call(SoSeeder::class);
$this->call(LaratrustSeeder::class);
$this->call(UsersTableSeeder::class);
$this->call(DeliveryInfoSeeder::class);
$this->call(CompanySeeder::class);
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Seeder;
use Carbon\Carbon;
class DeliveryInfoSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('deliveryinfos')->insert([
'id' => '999',
'branch' => 'Testing',
'deli_info' => 'Testing',
'address' => 'Testing',
'city' => 'Test',
'postcode' => '12345',
'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'),
'com_id' => '999'
]);
}
}