create migration to remove fleet_end from Fleets table
cleaned up register fleet in FleetsController modified FleetHelper class
This commit is contained in:
@@ -105,32 +105,13 @@ class FleetsController extends Controller
|
|||||||
$check = DB::table('Fleets')->where('fleet', $fleetUri)->first();
|
$check = DB::table('Fleets')->where('fleet', $fleetUri)->first();
|
||||||
//If we do not find the fleet, let's create it.
|
//If we do not find the fleet, let's create it.
|
||||||
if($check === null) {
|
if($check === null) {
|
||||||
|
|
||||||
$current = Carbon::now();
|
|
||||||
//If we are between 00:00 and 05:00, we want to set the end time for 0500
|
|
||||||
if($current->hour > 0 && $current->hour < 5) {
|
|
||||||
//Figure out the hours to add to the fleet before purging it.
|
|
||||||
$hour = $current->hour;
|
|
||||||
$endTime = Carbon::now();
|
|
||||||
$endTime->hour = 11 - $hour;
|
|
||||||
} else {
|
|
||||||
//Figure out the hours to add to the fleet before purging it.
|
|
||||||
$endTime = Carbon::now();
|
|
||||||
$endTime->day++;
|
|
||||||
$endTime->hour = 11;
|
|
||||||
$endTime->minute = 0;
|
|
||||||
$endTime->second = 0;
|
|
||||||
}
|
|
||||||
// Insert the fleet into the table
|
// Insert the fleet into the table
|
||||||
DB::table('Fleets')->insert([
|
DB::table('Fleets')->insert([
|
||||||
'character_id' => Auth::user()->character_id,
|
'character_id' => Auth::user()->character_id,
|
||||||
'fleet' => $fleetUri,
|
'fleet' => $fleetUri,
|
||||||
'description' => $request->description,
|
'description' => $request->description,
|
||||||
'creation_time' => $current,
|
'creation_time' => $current,
|
||||||
'fleet_end' => $endTime,
|
|
||||||
]);
|
]);
|
||||||
//Is this line needed?
|
|
||||||
$fleet->SetFleetEndTime($endTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect('/fleets/display');
|
return redirect('/fleets/display');
|
||||||
|
|||||||
@@ -17,9 +17,8 @@ use Seat\Eseye\Eseye;
|
|||||||
|
|
||||||
class FleetHelper {
|
class FleetHelper {
|
||||||
|
|
||||||
private $fleet;
|
private $fleetUri;
|
||||||
private $fcId;
|
private $fcId;
|
||||||
private $endTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@@ -41,50 +40,15 @@ class FleetHelper {
|
|||||||
$uris = explode('https://esi.tech.ccp.is/v1/fleets/', $fleetUri);
|
$uris = explode('https://esi.tech.ccp.is/v1/fleets/', $fleetUri);
|
||||||
//Trim the right side of the fleet number
|
//Trim the right side of the fleet number
|
||||||
$fleetUri = rtrim($uris[1], '/?datasource=tranquility');
|
$fleetUri = rtrim($uris[1], '/?datasource=tranquility');
|
||||||
$this->fleet = $fleetUri;
|
$this->fleetUri = $fleetUri;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetFleetUri() {
|
public function GetFleetUri() {
|
||||||
return $this->fleet;
|
return $this->fleetUri;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function UpdateFleet() {
|
||||||
* Set the fleet's end time
|
return null;
|
||||||
*
|
|
||||||
* @param endTime
|
|
||||||
*/
|
|
||||||
public function SetFleetEndTime($endTime) {
|
|
||||||
$this->endTime = $endTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function UpdateFleet($fleet, $isFreeMove, $motd) {
|
|
||||||
//Get the fcid from the datatable
|
|
||||||
$fc = DB::table('Fleets')->where('fleet', $fleetId)->get();
|
|
||||||
|
|
||||||
//Check if the fc has the right scope
|
|
||||||
if(!$this->HaveEsiScope($fc->character_id, 'esi-fleets.write_fleet.v1')) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
//Get the FC's refresh token from the table
|
|
||||||
$token = DB::table('EsiTokens')->where('character_id', $fc->character_id)->first();
|
|
||||||
//Create the esi authentication container
|
|
||||||
$config = config('esi');
|
|
||||||
$authentication = new EsiAuthentication([
|
|
||||||
'client_id' => $config['client_id'],
|
|
||||||
'secret' => $config['secret'],
|
|
||||||
'refresh_token' => $token->refresh_token,
|
|
||||||
]);
|
|
||||||
//Create the esi class
|
|
||||||
$esi = new Eseye($authentication);
|
|
||||||
$error = $esi->invoke('put', '/fleets/{fleet_id}/', [
|
|
||||||
'fleet_id' => $fleet,
|
|
||||||
'new_settings' => [
|
|
||||||
'is_free_move' => $isFreeMove,
|
|
||||||
'motd' => $motd,
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
|
|
||||||
return $error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function AddPilot($fc, $charId, $fleetId) {
|
public function AddPilot($fc, $charId, $fleetId) {
|
||||||
@@ -119,10 +83,6 @@ class FleetHelper {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function RenderFleetDisplay() {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class DropFleetEndColumnFleetsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('Fleets', function($table) {
|
||||||
|
$table->dropColumn('fleet_end');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('Fleets', function($table) {
|
||||||
|
$table->dateTime('fleet_end');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -7,9 +7,9 @@ $baseDir = dirname($vendorDir);
|
|||||||
|
|
||||||
return array(
|
return array(
|
||||||
'App\\Console\\Commands\\CorpJournal' => $baseDir . '/app/Console/Commands/corpJournal.php',
|
'App\\Console\\Commands\\CorpJournal' => $baseDir . '/app/Console/Commands/corpJournal.php',
|
||||||
|
'App\\Console\\Commands\\DumpFleets' => $baseDir . '/app/Console/Commands/dumpFleets.php',
|
||||||
'App\\Console\\Commands\\GetCorps' => $baseDir . '/app/Console/Commands/getCorps.php',
|
'App\\Console\\Commands\\GetCorps' => $baseDir . '/app/Console/Commands/getCorps.php',
|
||||||
'App\\Console\\Commands\\UpdateMoonPricing' => $baseDir . '/app/Console/Commands/UpdateMoonPricing.php',
|
'App\\Console\\Commands\\UpdateMoonPricing' => $baseDir . '/app/Console/Commands/UpdateMoonPricing.php',
|
||||||
'App\\Console\\Commands\\dumpFleets' => $baseDir . '/app/Console/Commands/dumpFleets.php',
|
|
||||||
'App\\Console\\Commands\\getLogisticContracts' => $baseDir . '/app/Console/Commands/getLogisticContracts.php',
|
'App\\Console\\Commands\\getLogisticContracts' => $baseDir . '/app/Console/Commands/getLogisticContracts.php',
|
||||||
'App\\Console\\Commands\\sendMail' => $baseDir . '/app/Console/Commands/sendmail.php',
|
'App\\Console\\Commands\\sendMail' => $baseDir . '/app/Console/Commands/sendmail.php',
|
||||||
'App\\Console\\Kernel' => $baseDir . '/app/Console/Kernel.php',
|
'App\\Console\\Kernel' => $baseDir . '/app/Console/Kernel.php',
|
||||||
|
|||||||
Vendored
+1
-1
@@ -402,9 +402,9 @@ class ComposerStaticInitc3f953f8a7291d41a76e1664339777c9
|
|||||||
|
|
||||||
public static $classMap = array (
|
public static $classMap = array (
|
||||||
'App\\Console\\Commands\\CorpJournal' => __DIR__ . '/../..' . '/app/Console/Commands/corpJournal.php',
|
'App\\Console\\Commands\\CorpJournal' => __DIR__ . '/../..' . '/app/Console/Commands/corpJournal.php',
|
||||||
|
'App\\Console\\Commands\\DumpFleets' => __DIR__ . '/../..' . '/app/Console/Commands/dumpFleets.php',
|
||||||
'App\\Console\\Commands\\GetCorps' => __DIR__ . '/../..' . '/app/Console/Commands/getCorps.php',
|
'App\\Console\\Commands\\GetCorps' => __DIR__ . '/../..' . '/app/Console/Commands/getCorps.php',
|
||||||
'App\\Console\\Commands\\UpdateMoonPricing' => __DIR__ . '/../..' . '/app/Console/Commands/UpdateMoonPricing.php',
|
'App\\Console\\Commands\\UpdateMoonPricing' => __DIR__ . '/../..' . '/app/Console/Commands/UpdateMoonPricing.php',
|
||||||
'App\\Console\\Commands\\dumpFleets' => __DIR__ . '/../..' . '/app/Console/Commands/dumpFleets.php',
|
|
||||||
'App\\Console\\Commands\\getLogisticContracts' => __DIR__ . '/../..' . '/app/Console/Commands/getLogisticContracts.php',
|
'App\\Console\\Commands\\getLogisticContracts' => __DIR__ . '/../..' . '/app/Console/Commands/getLogisticContracts.php',
|
||||||
'App\\Console\\Commands\\sendMail' => __DIR__ . '/../..' . '/app/Console/Commands/sendmail.php',
|
'App\\Console\\Commands\\sendMail' => __DIR__ . '/../..' . '/app/Console/Commands/sendmail.php',
|
||||||
'App\\Console\\Kernel' => __DIR__ . '/../..' . '/app/Console/Kernel.php',
|
'App\\Console\\Kernel' => __DIR__ . '/../..' . '/app/Console/Kernel.php',
|
||||||
|
|||||||
Reference in New Issue
Block a user