mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-25 15:34:06 +00:00
solve multiple error
This commit is contained in:
@@ -44,7 +44,7 @@ class SoController extends Controller
|
||||
|
||||
//shipping order
|
||||
$so = new So;
|
||||
$so->ff_id = $request->input('ff_id');
|
||||
$so->ff_id = Auth::user()->company()->id;
|
||||
$so->supplier_company_name = $request->input('supplier_company_name');
|
||||
$so->supplier_contact_person = $request->input('supplier_contact_person');
|
||||
$so->supplier_contact_person_no = $request->input('supplier_contact_person_no');
|
||||
|
||||
+6
-1
@@ -17,7 +17,12 @@ class So extends Model
|
||||
|
||||
public function Soitem()
|
||||
{
|
||||
return $this->hasMany('App\Soitem', 'so_id');
|
||||
return $this->hasMany('App\Soitem');
|
||||
}
|
||||
|
||||
public function company()
|
||||
{
|
||||
return $this->belongsTo('App\Company');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,17 +15,11 @@ class CreateSosTable extends Migration
|
||||
{
|
||||
Schema::create('sos', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
|
||||
//Order details
|
||||
$table->integer('ff_id');
|
||||
$table->string('supplier_company_name');
|
||||
$table->string('supplier_contact_person');
|
||||
$table->integer('supplier_contact_person_no');
|
||||
|
||||
//Delivery details
|
||||
$table->integer('delivery_id');
|
||||
|
||||
//Warehouse details
|
||||
$table->integer('warehouse_id');
|
||||
$table->timestamps();
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddForeignKeyComidToTheSosTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('sos', function (Blueprint $table) {
|
||||
|
||||
// foreign key for the company table
|
||||
$table->unsignedInteger('com_id');
|
||||
$table->foreign('com_id')
|
||||
->references('id')->on('companies')
|
||||
->onDelete('cascade');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('sos', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -16,14 +16,15 @@ class SoSeeder extends Seeder
|
||||
DB::table('sos')->insert([
|
||||
|
||||
'id' => '9999',
|
||||
'ff_id' => '4',
|
||||
'ff_id' => '1',
|
||||
'supplier_company_name' => 'SEED',
|
||||
'supplier_contact_person' => 'SEED',
|
||||
'supplier_contact_person_no' => '1234',
|
||||
'delivery_id' => '4',
|
||||
'warehouse_id' => '4',
|
||||
'delivery_id' => '1',
|
||||
'warehouse_id' => '1',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class SoitemSeeder extends Seeder
|
||||
'packaging_width' => '1',
|
||||
'packaging_depth' => '1',
|
||||
'packaging_gross' => '1',
|
||||
'packaging_nett' => '41',
|
||||
'packaging_nett' => '1',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
|
||||
@@ -53,7 +53,7 @@ class SoitemSeeder extends Seeder
|
||||
'packaging_width' => '1',
|
||||
'packaging_depth' => '1',
|
||||
'packaging_gross' => '1',
|
||||
'packaging_nett' => '41',
|
||||
'packaging_nett' => '1',
|
||||
'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