mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-31 18:34:14 +00:00
can insert both so and soitem into db, but have an error
This commit is contained in:
@@ -15,7 +15,6 @@ class CreateSoitemsTable extends Migration
|
||||
{
|
||||
Schema::create('soitems', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
|
||||
// foreign key for the so table
|
||||
$table->unsignedInteger('so_id');
|
||||
$table->foreign('so_id')
|
||||
|
||||
@@ -11,6 +11,7 @@ class DatabaseSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// $this->call(UsersTableSeeder::class);
|
||||
//$this->call(UsersTableSeeder::class);
|
||||
$this->call(SoSeeder::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\So;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class SoSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('sos')->insert([
|
||||
|
||||
// 'id' => '8',
|
||||
'ff_id' => '4',
|
||||
'supplier_company_name' => 'SEED',
|
||||
'supplier_contact_person' => 'SEED',
|
||||
'supplier_contact_person_no' => '1234',
|
||||
'delivery_id' => '4',
|
||||
'warehouse_id' => '4',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Soitems;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class SoitemSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
||||
DB::table('soitems')->insert([
|
||||
|
||||
([
|
||||
|
||||
// 'id' => '8',
|
||||
'so_id' => '2',
|
||||
'status' => '0',
|
||||
'order_id' => '1',
|
||||
'brand_no' => '1',
|
||||
'model_no' => '1',
|
||||
'item_code' => '1',
|
||||
'quantity_of_item' => '1',
|
||||
'uom' => 'SEED',
|
||||
'quantity_of_carton' => '1',
|
||||
'packaging_type' => '1',
|
||||
'packaging_height' => '1',
|
||||
'packaging_width' => '1',
|
||||
'packaging_depth' => '1',
|
||||
'packaging_gross' => '1',
|
||||
'packaging_nett' => '41',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
|
||||
]),
|
||||
([
|
||||
// 'id' => '8',
|
||||
'so_id' => '2',
|
||||
'status' => '0',
|
||||
'order_id' => '1',
|
||||
'brand_no' => '1',
|
||||
'model_no' => '1',
|
||||
'item_code' => '1',
|
||||
'quantity_of_item' => '1',
|
||||
'uom' => 'SEED',
|
||||
'quantity_of_carton' => '1',
|
||||
'packaging_type' => '1',
|
||||
'packaging_height' => '1',
|
||||
'packaging_width' => '1',
|
||||
'packaging_depth' => '1',
|
||||
'packaging_gross' => '1',
|
||||
'packaging_nett' => '41',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
]),
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user