large commit

This commit is contained in:
Omair Saleh
2019-07-20 11:02:05 +08:00
parent f46dd05d6b
commit 74138388be
35 changed files with 786 additions and 430 deletions
+6 -5
View File
@@ -4,13 +4,14 @@ use Faker\Generator as Faker;
$factory->define(App\Models\AddressBook::class, function (Faker $faker) {
return [
'company_id' => $faker->numberBetween(1, 30),
'reference' => $faker->name,
'contact' => $faker->numerify('01########'),
'reference' => $faker->firstName.' '.$faker->lastName,
'contact' => $faker->phoneNumber,
'street_one' => $faker->streetAddress,
'city' => $faker->city,
'state' => $faker->city,
'state' => $faker->state,
'post_code' => $faker->postcode,
'country' => $faker->country
'country' => 'Malaysia',
'default' => 1,
'billing' => 1
];
});
+1 -1
View File
@@ -4,7 +4,7 @@ use Faker\Generator as Faker;
$factory->define(App\Models\Company::class, function (Faker $faker) {
return [
'name' => $faker->company,
'name' => $faker->firstName.' '.$faker->companySuffix,
'marking' => 'CIEF/'.$faker->numerify('###').$faker->regexify('[A-Z]{3}'),
'email' => $faker->companyEmail,
'registration_no' => $faker->numerify('######-W'),
@@ -15,7 +15,7 @@ class CreateCompaniesTable extends Migration
{
Schema::create('companies', function (Blueprint $table) {
$table->increments('id');
$table->string('name', 80);
$table->string('name');
$table->string('marking', 80)->unique();
$table->string('email', 80)->nullable();
$table->string('wechat_id', 80)->nullable();
@@ -16,7 +16,7 @@ class CreateAddressBookTable extends Migration
Schema::create('address_book', function (Blueprint $table) {
$table->increments('id');
$table->integer('company_id')->unsigned()->index();
$table->string('reference', 50)->nullable();
$table->string('reference')->nullable();
$table->string('contact', 25)->nullable();
$table->string('street_one', 80)->nullable();
$table->string('street_two', 80)->nullable();
@@ -15,7 +15,7 @@ class CreateWarehousesTable extends Migration
{
Schema::create('warehouses', function (Blueprint $table) {
$table->increments('id');
$table->string('name', 50);
$table->string('name');
$table->string('email', 80)->nullable();
$table->string('street_one', 80)->nullable();
$table->string('street_two', 80)->nullable();
+1 -1
View File
@@ -11,6 +11,6 @@ class AddressBookTableSeeder extends Seeder
*/
public function run()
{
factory(App\Models\AddressBook::class, 300)->create();
factory(App\Models\AddressBook::class, 2)->create();
}
}
+3 -1
View File
@@ -11,6 +11,8 @@ class CompaniesTableSeeder extends Seeder
*/
public function run()
{
factory(App\Models\Company::class, 30)->create();
factory(App\Models\Company::class, 30)->create()->each(function ($company) {
$company->addressBook()->save(factory(App\Models\AddressBook::class)->make());
});
}
}
+1 -1
View File
@@ -12,7 +12,7 @@ class DatabaseSeeder extends Seeder
public function run(): void {
if(app()->environment() !== "production"){
$this->call(CompaniesTableSeeder::class);
$this->call(AddressBookTableSeeder::class);
// $this->call(AddressBookTableSeeder::class);
$this->call(ContactsTableSeeder::class);
$this->call(WarehousesTableSeeder::class);
// $this->call(OrdersTableSeeder::class);