mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-21 21:44:18 +00:00
complete the model, controller, and migration
This commit is contained in:
+5
-1
@@ -7,7 +7,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class So extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'ff_id',
|
||||
'supplier_company_name',
|
||||
'supplier_contact_person',
|
||||
@@ -16,4 +15,9 @@ class So extends Model
|
||||
'warehouse_id',
|
||||
];
|
||||
|
||||
public function Soitem()
|
||||
{
|
||||
return $this->hasMany(Soitem::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+8
-1
@@ -7,7 +7,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Soitem extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'so_id',
|
||||
'status',
|
||||
'order_id',
|
||||
'brand_no',
|
||||
'model_no',
|
||||
@@ -24,4 +25,10 @@ class Soitem extends Model
|
||||
|
||||
];
|
||||
|
||||
public function So()
|
||||
{
|
||||
return $this->belongsTo(So::class);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+8
@@ -16,6 +16,14 @@ 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')
|
||||
->references('id')->on('sos')
|
||||
->onDelete('cascade')
|
||||
->onUpdate('cascade');
|
||||
$table->Integer('status')->default('0');
|
||||
|
||||
//Item details
|
||||
$table->integer('order_id');
|
||||
$table->integer('brand_no');
|
||||
+1
-1
@@ -16,7 +16,7 @@ use Illuminate\Http\Request;
|
||||
//Route for the shipping order
|
||||
Route::get('/so', 'SoController@index');// get the list of the shipping order
|
||||
Route::get('/so/{so_id}', 'SoController@so');//get the shipping order
|
||||
Route::post('/so/{so_id}', 'SoController@store');//create shipping order
|
||||
Route::post('/so/{so_id}', 'SoController@store');//store shipping order
|
||||
Route::post('/so/{so_id}/cancel-order', 'SoController@cancelorder');//post the cancel order
|
||||
Route::delete('/so/{so_id}', 'SoController@delete');// delete the shipping order
|
||||
Route::put('/so/{so_id}', 'SoController@update');//update the shipping order
|
||||
|
||||
Reference in New Issue
Block a user