srp form
This commit is contained in:
@@ -12,6 +12,9 @@ use Auth;
|
||||
|
||||
//Models
|
||||
use App\Models\SRP\Ship;
|
||||
use App\Models\User\User;
|
||||
use App\Models\SRP\SrpFleetType;
|
||||
use App\Models\SRP\SrpShipType;
|
||||
|
||||
class SRPAdminController extends Controller
|
||||
{
|
||||
|
||||
@@ -13,6 +13,8 @@ use Auth;
|
||||
//Models
|
||||
use App\Models\SRP\SRPShip;
|
||||
use App\Models\User\User;
|
||||
use App\Models\SRP\SrpFleetType;
|
||||
use App\Models\SRP\SrpShipType;
|
||||
|
||||
class SRPController extends Controller
|
||||
{
|
||||
@@ -22,7 +24,24 @@ class SRPController extends Controller
|
||||
}
|
||||
|
||||
public function displaySrpForm() {
|
||||
return view('srp.srpform');
|
||||
$shipTypes = array();
|
||||
$fleetTypes = array();
|
||||
|
||||
$shipTypesTemp = SrpShipType::all();
|
||||
$fleetTypesTemp = SrpFleetType::all();
|
||||
|
||||
foreach($shipTypesTemp as $key => $value) {
|
||||
$temp[$key] = $value;
|
||||
array_push($shipTypes, $temp);
|
||||
}
|
||||
|
||||
foreach($fleetTypesTemp as $key => $value) {
|
||||
$temp[$key] = $value;
|
||||
array_push($fleetTypes, $temp);
|
||||
}
|
||||
|
||||
return view('srp.srpform')->with('fleetTypes', $fleetTypes)
|
||||
->with('shipTypes', $shipTypes);
|
||||
}
|
||||
|
||||
public function storeSRPFile(Request $request) {
|
||||
@@ -52,7 +71,6 @@ class SRPController extends Controller
|
||||
$ship->zkillboard = $request->zKillboard;
|
||||
$ship->ship_type = $request->ShipType;
|
||||
$ship->loss_value = $lossValue;
|
||||
dd($ship);
|
||||
$ship->save();
|
||||
|
||||
return redirect('/srpform')->with('success', 'SRP Form Submitted.');
|
||||
|
||||
@@ -6,5 +6,12 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SrpFleetType extends Model
|
||||
{
|
||||
//
|
||||
//Table Name
|
||||
protected $table = 'srp_fleet_types';
|
||||
|
||||
//Primary Key
|
||||
public $primaryKey = 'id';
|
||||
|
||||
//Timestamps
|
||||
public $timestamps = false;
|
||||
}
|
||||
|
||||
@@ -6,5 +6,12 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SrpShipType extends Model
|
||||
{
|
||||
//
|
||||
//Table Name
|
||||
protected $table = 'srp_ship_types';
|
||||
|
||||
//Primary Key
|
||||
public $primaryKey = 'id';
|
||||
|
||||
//Timestamps
|
||||
public $timestamps = false;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,97 @@ class CreateSrpTables extends Migration
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
if(!Schema::hasTable('srp_fleet_types')) {
|
||||
Schema::create('srp_fleet_types', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('code');
|
||||
$table->string('description');
|
||||
});
|
||||
}
|
||||
|
||||
if(!Schema::hasTable('srp_ship_types')) {
|
||||
Schema::create('srp_ship_types', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('code');
|
||||
$table->string('description');
|
||||
});
|
||||
}
|
||||
|
||||
DB::table('srp_fleet_types')->insert([
|
||||
'code' => 'None',
|
||||
'description' => 'None',
|
||||
]);
|
||||
|
||||
DB::table('srp_fleet_types')->insert([
|
||||
'code' => 'Home Defense',
|
||||
'description' => 'Home Defense',
|
||||
]);
|
||||
|
||||
DB::table('srp_fleet_types')->insert([
|
||||
'code' => 'Legacy Ops',
|
||||
'description' => 'Legacy Ops',
|
||||
]);
|
||||
|
||||
DB::table('srp_fleet_types')->insert([
|
||||
'code' => 'Strat Op',
|
||||
'description' => 'Strat Op',
|
||||
]);
|
||||
|
||||
DB::table('srp_fleet_types')->insert([
|
||||
'code' => 'CTA',
|
||||
'description' => 'CTA',
|
||||
]);
|
||||
|
||||
DB::table('srp_ship_types')->insert([
|
||||
'code' => 'None',
|
||||
'description' => 'None',
|
||||
]);
|
||||
|
||||
DB::table('srp_ship_types')->insert([
|
||||
'code' => 'T1FDC',
|
||||
'description' => 'T1 Frig / Dessie / Cruiser',
|
||||
]);
|
||||
|
||||
DB::table('srp_ship_types')->insert([
|
||||
'code' => 'T1BC',
|
||||
'description' => 'T1 Battelcruiser',
|
||||
]);
|
||||
|
||||
DB::table('srp_ship_types')->insert([
|
||||
'code' => 'T2F',
|
||||
'description' => 'T2 Frigate',
|
||||
]);
|
||||
|
||||
DB::table('srp_ship_types')->insert([
|
||||
'code' => 'T3D',
|
||||
'description' => 'T3 Destroyer',
|
||||
]);
|
||||
|
||||
DB::table('srp_ship_types')->insert([
|
||||
'code' => 'T1T2Logi',
|
||||
'description' => 'T1 & T2 Logistics',
|
||||
]);
|
||||
|
||||
DB::table('srp_ship_types')->insert([
|
||||
'code' => 'RI',
|
||||
'description' => 'Recons / Interdictors',
|
||||
]);
|
||||
|
||||
DB::table('srp_ship_types')->insert([
|
||||
'code' => 'T2C',
|
||||
'description' => 'T2 Cruiser',
|
||||
]);
|
||||
|
||||
DB::table('srp_ship_types')->insert([
|
||||
'code' => 'T3C',
|
||||
'description' => 'T3 Cruiser',
|
||||
]);
|
||||
|
||||
DB::table('srp_ship_types')->insert([
|
||||
'code' => 'COM',
|
||||
'description' => 'Command Ship',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user