added prices table
This commit is contained in:
@@ -188,11 +188,11 @@ class MoonCalc {
|
||||
$promethiumPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16652, $maxTime]);
|
||||
$thuliumPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16653, $maxTime]);
|
||||
//Get the item compositions
|
||||
$items = DB::select('SELECT Name,ItemId FROM ItemComposition');
|
||||
$items = DB::select('SELECT Name,ItemId FROM item_composition');
|
||||
//Go through each of the items and update the price
|
||||
foreach($items as $item) {
|
||||
//Get the item composition
|
||||
$composition = DB::select('SELECT * FROM ItemComposition WHERE ItemId = ?', [$item['ItemId']]);
|
||||
$composition = DB::select('SELECT * FROM item_composition WHERE ItemId = ?', [$item['ItemId']]);
|
||||
//Calculate the Batch Price
|
||||
$batchPrice = ( ($composition['Tritanium'] * $tritaniumPrice) +
|
||||
($composition['Pyerite'] * $pyeritePrice) +
|
||||
@@ -270,7 +270,7 @@ class MoonCalc {
|
||||
//Specify the total pull amount
|
||||
$totalPull = 5.55 * (3600.00 * 24.00 * 30.00);
|
||||
//Find the size of the asteroid from the database
|
||||
$m3Size = DB::table('ItemComposition')->where('Name', $ore)->value('m3Size');
|
||||
$m3Size = DB::table('item_composition')->where('Name', $ore)->value('m3Size');
|
||||
//Calculate the actual m3 from the total pull amount in m3 using the percentage of the ingredient
|
||||
$actualm3 = floor($percentage * $totalPull);
|
||||
//Calculate the units once we have the size and actual m3 value
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePricesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('prices', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->text('Name');
|
||||
$table->integer('ItemId');
|
||||
$table->decimal('Price', 20, 2);
|
||||
$table->string('Time');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('prices');
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ SET time_zone = "+00:00";
|
||||
-- Table structure for table `Moons`
|
||||
--
|
||||
|
||||
CREATE TABLE `moons` (
|
||||
CREATE TABLE IF NOT EXISTS `moons` (
|
||||
`id` int(10) NOT NULL,
|
||||
`System` varchar(10) DEFAULT NULL,
|
||||
`Planet` varchar(10) DEFAULT NULL,
|
||||
|
||||
-1
@@ -24,7 +24,6 @@ return array(
|
||||
'App\\Http\\Middleware\\TrimStrings' => $baseDir . '/app/Http/Middleware/TrimStrings.php',
|
||||
'App\\Http\\Middleware\\TrustProxies' => $baseDir . '/app/Http/Middleware/TrustProxies.php',
|
||||
'App\\Http\\Middleware\\VerifyCsrfToken' => $baseDir . '/app/Http/Middleware/VerifyCsrfToken.php',
|
||||
'App\\Library\\AllianceOrders' => $baseDir . '/app/Library/AllianceOrders.php',
|
||||
'App\\Library\\MoonCalc' => $baseDir . '/app/Library/MoonCalc.php',
|
||||
'App\\Moon' => $baseDir . '/app/Moon.php',
|
||||
'App\\Providers\\AppServiceProvider' => $baseDir . '/app/Providers/AppServiceProvider.php',
|
||||
|
||||
Vendored
-1
@@ -419,7 +419,6 @@ class ComposerStaticInitc3f953f8a7291d41a76e1664339777c9
|
||||
'App\\Http\\Middleware\\TrimStrings' => __DIR__ . '/../..' . '/app/Http/Middleware/TrimStrings.php',
|
||||
'App\\Http\\Middleware\\TrustProxies' => __DIR__ . '/../..' . '/app/Http/Middleware/TrustProxies.php',
|
||||
'App\\Http\\Middleware\\VerifyCsrfToken' => __DIR__ . '/../..' . '/app/Http/Middleware/VerifyCsrfToken.php',
|
||||
'App\\Library\\AllianceOrders' => __DIR__ . '/../..' . '/app/Library/AllianceOrders.php',
|
||||
'App\\Library\\MoonCalc' => __DIR__ . '/../..' . '/app/Library/MoonCalc.php',
|
||||
'App\\Moon' => __DIR__ . '/../..' . '/app/Moon.php',
|
||||
'App\\Providers\\AppServiceProvider' => __DIR__ . '/../..' . '/app/Providers/AppServiceProvider.php',
|
||||
|
||||
Reference in New Issue
Block a user