hauling configuration and hauling controller updates
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateHualingConfigTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if(!Schema::hasTable('hauling_configuration')) {
|
||||
Schema::create('hauling_configuration', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('load_size')->unique();
|
||||
$table->unsignedBigInteger('min_load_size');
|
||||
$table->ungiendBigInteger('max_load_size');
|
||||
$table->decimal('price_per_jump');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('hualing_config');
|
||||
}
|
||||
}
|
||||
40
database/seeds/HaulingConfigSeeder.php
Normal file
40
database/seeds/HaulingConfigSeeder.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
use App\Models\Config\HaulingConfig;
|
||||
|
||||
class HaulingConfigSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
printf("Adding hauling configuration.\r\n");
|
||||
HaulingConfig::insert([
|
||||
'load_size' => 'small',
|
||||
'min_load_size' => 0,
|
||||
'max_load_size' => 8000,
|
||||
'price_per_jump' => 600000,
|
||||
]);
|
||||
|
||||
HaulingConfig::insert([
|
||||
'load_size' => 'medium',
|
||||
'min_load_size' => 8000,
|
||||
'max_load_size' => 57500,
|
||||
'price_per_jump' => 800000,
|
||||
]);
|
||||
|
||||
HaulingConfig::insert([
|
||||
'load_size' => 'large',
|
||||
'min_load_size' => 57500,
|
||||
'max_load_size' => 800000,
|
||||
'price_per_jump' => 1000000,
|
||||
]);
|
||||
|
||||
printf("Finished adding hauling configuration.\r\n");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user