dropped order_id column in soitem table

This commit is contained in:
Zain Fauzan Rofie Azizi
2018-06-07 17:21:08 +08:00
parent 18c05ecb7d
commit 0226847eea
4 changed files with 47 additions and 16 deletions
+11 -8
View File
@@ -31,7 +31,7 @@ class SoController extends Controller
$so = new So;
$so = So::where("user_id", Auth::user()->com_id)->first();
$so->ff_id = Auth::user()->company()->id;// have to write a logic (validation) that only freight forwarder that added into contact can use the ff_id
$so->ff_id = Auth::user()->company()->id; // have to write a logic (validation) that only freight forwarder that added into contact can use the ff_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');
@@ -46,9 +46,8 @@ class SoController extends Controller
foreach ($soitems as $soitem)
{
$new_soitem = new Soitem(array(
'so_id'=>$soitem['so_id'],
'so_id'=>$so->id,
'status'=>$soitem['status'],
'order_id'=>$soitem['order_id'],
'brand_no'=>$soitem['brand_no'],
'model_no'=>$soitem['model_no'],
'item_code'=>$soitem['item_code'],
@@ -72,19 +71,23 @@ class SoController extends Controller
}
/**
* Store a newly created resource in storage.
/**
*cancel the shipping order.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
//post the cancel order
public function cancelOrder(Request $request)
{
$so = So::find($id);
}
$so->save();
$com_id = auth()->user->id;
return response()->json(['so'=>$so],200);
}
/**
* Update the shipping order and item.
-1
View File
@@ -9,7 +9,6 @@ class Soitem extends Model
protected $fillable = [
'so_id',
'status',
'order_id',
'brand_no',
'model_no',
'item_code',
@@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class DropOrderIdColumn extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('soitems', function (Blueprint $table) {
$table->dropColumn('order_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('soitems', function (Blueprint $table) {
//
});
}
}
+2 -7
View File
@@ -14,12 +14,6 @@ use Illuminate\Http\Request;
|
*/
//Route::middleware('auth:api')->get('/user', function (Request $request) {
// return $request->user();
//});
@@ -36,9 +30,10 @@ Route::group(['middleware' => ['jwt.auth']], function() {
});
/* shipping order */
Route::get('/so/{so_id}', 'SoController@showso');//get the shipping order
Route::get('/so', 'SoController@showso');//get the shipping order
Route::post('/so', 'SoController@store');//store shipping order
Route::delete('/so/{so_id}', 'SoController@delete');// delete the shipping order
Route::put('/so/{so_id}/cancelOrder', 'SoController@cancelOrder');//post the cancel order
Route::put('/so/{so_id}', 'SoController@update');//update the shipping order
});