schedule-update-delete-backend

This commit is contained in:
mhmj
2019-07-17 14:47:10 +08:00
parent f46dd05d6b
commit 8c2f109a18
8 changed files with 247 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace App\Models;
class CustomerRelation extends AbstractModel
{
protected $table = 'customer_relation';
protected $fillable = [
'forwarder_id', 'company_id', 'customer_rate'
];
public function forwarder()
{
return $this->belongsTo(Forwarder::class, 'forwarder_id');
}
}
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace App\Models;
class Forwarder extends AbstractModel
{
protected $table = 'forwarder';
protected $fillable = [
'name', 'email', 'street_one', 'street_two', 'city', 'state', 'post_code', 'country', 'shipping_rate'
];
public function customerRelation()
{
return $this->hasMany(CustomerRelation::class, 'forwarder_id');
}
public function locationFees()
{
return $this->hasMany(LocationFees::class, 'forwarder_id');
}
public function serviceFees()
{
return $this->hasMany(ServiceFees::class, 'forwarder_id');
}
}
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace App\Models;
class LocationFees extends AbstractModel
{
protected $table = 'location_fees';
protected $fillable = [
'forwarder_id', 'state', 'rate', 'outstation_rate'
];
public function forwarder()
{
return $this->belongsTo(Forwarder::class, 'forwarder_id');
}
}
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace App\Models;
class ServiceFees extends AbstractModel
{
protected $table = 'service_fees';
protected $fillable = [
'name', 'type', 'description', 'cost', 'forwarder_id'
];
public function forwarder()
{
return $this->belongsTo(Forwarder::class, 'forwarder_id');
}
}
@@ -0,0 +1,60 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
class CreateForwarderTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('forwarder', function (Blueprint $table) {
$table->increments('id');
$table->string('name', 50);
$table->string('email', 80)->nullable();
$table->string('street_one', 80)->nullable();
$table->string('street_two', 80)->nullable();
$table->string('city', 50)->nullable();
$table->string('state', 50)->nullable();
$table->string('post_code', 10)->nullable();
$table->string('country')->nullable();
$table->float('shipping_rate');
$table->integer('overdue_days')->nullable();
$table->float('markup_percentage')->nullable();
$table->timestamps();
});
DB::table('forwarder')->insert(
[
'name' => 'CIEF Worldwide SDN BHD',
'email' => 'infociefworldwide@gmail.com',
'street_one' => 'Malaysian Global Innovation & Creativity Centre(MaGIC)',
'street_two' => ' CWS Block, 3730, Persiaran Apec',
'city' => 'Cyberjaya',
'state' => 'Selangor',
'post_code' => '63000',
'country' => 'Malaysia',
'shipping_rate' => '300',
'overdue_days' => '0',
'markup_percentage' => '0',
'created_at' => \Carbon\Carbon::now(),
'updated_at' => \Carbon\Carbon::now()
]
);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('forwarder');
}
}
@@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateLocationFeesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('location_fees', function (Blueprint $table) {
$table->increments('id');
$table->integer('forwarder_id')->unsigned()->nullable();
$table->string('state')->nullable();
$table->float('rate')->nullable();
$table->float('outstation_rate')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('location_fees');
}
}
@@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateServiceFeesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('service_fees', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->nullable();
$table->string('type')->nullable();
$table->string('description')->nullable();
$table->float('cost')->nullable();
$table->integer('forwarder_id')->unsigned()->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('service_fees');
}
}
@@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCustomerRelationTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('customer_relation', function (Blueprint $table) {
$table->increments('id');
$table->integer('forwarder_id')->unsigned()->nullable();
$table->integer('company_id')->unsigned()->nullable();
$table->string('customer_rate')->nullable();
$table->float('wave')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('customer_relation');
}
}