solve multiple error

This commit is contained in:
Zain Fauzan Rofie Azizi
2018-06-07 09:55:43 +08:00
parent 9619cab407
commit 1361538f8b
6 changed files with 51 additions and 13 deletions
+1 -1
View File
@@ -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
View File
@@ -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) {
//
});
}
}
+4 -3
View File
@@ -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'),
]);
}
}
+2 -2
View File
@@ -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'),
]),