item composition model
This commit is contained in:
14
app/ItemComposition.php
Normal file
14
app/ItemComposition.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ItemComposition extends Model
|
||||
{
|
||||
// Table Name
|
||||
protected $table = 'ItemComposition';
|
||||
|
||||
// Timestamps
|
||||
public $timestamps = 'false';
|
||||
}
|
||||
@@ -15,6 +15,7 @@ use GuzzleHttp\Client;
|
||||
use App\Config;
|
||||
use App\Moon;
|
||||
use App\Price;
|
||||
use App\ItemComposition;
|
||||
|
||||
class MoonCalc {
|
||||
|
||||
@@ -193,9 +194,8 @@ class MoonCalc {
|
||||
foreach($items as $item) {
|
||||
//Get the item composition
|
||||
$composition = DB::select('SELECT * FROM ItemComposition WHERE ItemId = ?', [$item->ItemId]);
|
||||
dd($composition);
|
||||
//Calculate the Batch Price
|
||||
$batchPrice = ( ($composition['Tritanium'] * $tritaniumPrice) +
|
||||
$batchPrice = ( ($composition->Tritanium * $tritaniumPrice) +
|
||||
($composition['Pyerite'] * $pyeritePrice) +
|
||||
($composition['Mexallon'] * $mexallonPrice) +
|
||||
($composition['Isogen'] * $isogenPrice) +
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateItemCompositionTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ItemComposition', function (Blueprint $table) {
|
||||
$table->string('Name')->unique();
|
||||
$table->integer('ItemId');
|
||||
$table->decimal('m3Size', 10, 2)->default(0.00);
|
||||
$table->integer('BatchSize')->default(100);
|
||||
$table->integer('Tritanium')->default(0);
|
||||
$table->integer('Pyerite')->default(0);
|
||||
$table->integer('Mexallon')->default(0);
|
||||
$table->integer('Isogen')->default(0);
|
||||
$table->integer('Nocxium')->default(0);
|
||||
$table->integer('Zydrine')->default(0);
|
||||
$table->integer('Megacyte')->default(0);
|
||||
$table->integer('Morphite')->default(0);
|
||||
$table->integer('HeavyWater')->default(0);
|
||||
$table->integer('LiquidOzone')->default(0);
|
||||
$table->integer('NitrogenIsotopes')->default(0);
|
||||
$table->integer('HeliumIsotopes')->default(0);
|
||||
$table->integer('HydrogenIsotopes')->default(0);
|
||||
$table->integer('OxygenIsotopes')->default(0);
|
||||
$table->integer('StrontiumClathrates')->default(0);
|
||||
$table->integer('AtmosphericGases')->default(0);
|
||||
$table->integer('EvaporiteDeposits')->default(0);
|
||||
$table->integer('Hydrocarbons')->default(0);
|
||||
$table->integer('Silicates')->default(0);
|
||||
$table->integer('Cobalt')->default(0);
|
||||
$table->integer('Scandium')->default(0);
|
||||
$table->integer('Titanium')->default(0);
|
||||
$table->integer('Tungsten')->default(0);
|
||||
$table->integer('Cadmium')->default(0);
|
||||
$table->integer('Platinum')->default(0);
|
||||
$table->integer('Vanadium')->default(0);
|
||||
$table->integer('Chromium')->default(0);
|
||||
$table->integer('Technetium')->default(0);
|
||||
$table->integer('Hafnium')->default(0);
|
||||
$table->integer('Caesium')->default(0);
|
||||
$table->integer('Mercury')->default(0);
|
||||
$table->integer('Dysprosium')->default(0);
|
||||
$table->integer('Neodymium')->default(0);
|
||||
$table->integer('Promethium')->default(0);
|
||||
$table->integer('Thulium')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ItemComposition');
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ SET time_zone = "+00:00";
|
||||
-- Table structure for table `ItemComposition`
|
||||
--
|
||||
|
||||
CREATE TABLE `ItemComposition` (
|
||||
CREATE TABLE IF NOT EXISTS `ItemComposition` (
|
||||
`Name` varchar(31) DEFAULT NULL,
|
||||
`ItemId` int(10) NOT NULL,
|
||||
`m3Size` decimal(10,2) NOT NULL DEFAULT 0.00,
|
||||
|
||||
2
vendor/composer/autoload_classmap.php
vendored
2
vendor/composer/autoload_classmap.php
vendored
@@ -6,6 +6,7 @@ $vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'App\\Config' => $baseDir . '/app/Config.php',
|
||||
'App\\Console\\Kernel' => $baseDir . '/app/Console/Kernel.php',
|
||||
'App\\Exceptions\\Handler' => $baseDir . '/app/Exceptions/Handler.php',
|
||||
'App\\Http\\Controllers\\Auth\\ForgotPasswordController' => $baseDir . '/app/Http/Controllers/Auth/ForgotPasswordController.php',
|
||||
@@ -26,6 +27,7 @@ return array(
|
||||
'App\\Http\\Middleware\\VerifyCsrfToken' => $baseDir . '/app/Http/Middleware/VerifyCsrfToken.php',
|
||||
'App\\Library\\MoonCalc' => $baseDir . '/app/Library/MoonCalc.php',
|
||||
'App\\Moon' => $baseDir . '/app/Moon.php',
|
||||
'App\\Price' => $baseDir . '/app/Price.php',
|
||||
'App\\Providers\\AppServiceProvider' => $baseDir . '/app/Providers/AppServiceProvider.php',
|
||||
'App\\Providers\\AuthServiceProvider' => $baseDir . '/app/Providers/AuthServiceProvider.php',
|
||||
'App\\Providers\\BroadcastServiceProvider' => $baseDir . '/app/Providers/BroadcastServiceProvider.php',
|
||||
|
||||
2
vendor/composer/autoload_static.php
vendored
2
vendor/composer/autoload_static.php
vendored
@@ -401,6 +401,7 @@ class ComposerStaticInitc3f953f8a7291d41a76e1664339777c9
|
||||
);
|
||||
|
||||
public static $classMap = array (
|
||||
'App\\Config' => __DIR__ . '/../..' . '/app/Config.php',
|
||||
'App\\Console\\Kernel' => __DIR__ . '/../..' . '/app/Console/Kernel.php',
|
||||
'App\\Exceptions\\Handler' => __DIR__ . '/../..' . '/app/Exceptions/Handler.php',
|
||||
'App\\Http\\Controllers\\Auth\\ForgotPasswordController' => __DIR__ . '/../..' . '/app/Http/Controllers/Auth/ForgotPasswordController.php',
|
||||
@@ -421,6 +422,7 @@ class ComposerStaticInitc3f953f8a7291d41a76e1664339777c9
|
||||
'App\\Http\\Middleware\\VerifyCsrfToken' => __DIR__ . '/../..' . '/app/Http/Middleware/VerifyCsrfToken.php',
|
||||
'App\\Library\\MoonCalc' => __DIR__ . '/../..' . '/app/Library/MoonCalc.php',
|
||||
'App\\Moon' => __DIR__ . '/../..' . '/app/Moon.php',
|
||||
'App\\Price' => __DIR__ . '/../..' . '/app/Price.php',
|
||||
'App\\Providers\\AppServiceProvider' => __DIR__ . '/../..' . '/app/Providers/AppServiceProvider.php',
|
||||
'App\\Providers\\AuthServiceProvider' => __DIR__ . '/../..' . '/app/Providers/AuthServiceProvider.php',
|
||||
'App\\Providers\\BroadcastServiceProvider' => __DIR__ . '/../..' . '/app/Providers/BroadcastServiceProvider.php',
|
||||
|
||||
Reference in New Issue
Block a user