Added quota table and model.
This commit is contained in:
parent
2370c90170
commit
14698083f8
13275 changed files with 1397800 additions and 18 deletions
|
|
@ -4,6 +4,7 @@ namespace App\Http\Controllers;
|
|||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Season;
|
||||
use App\Quota;
|
||||
use DB;
|
||||
use Auth;
|
||||
use Log;
|
||||
|
|
@ -14,12 +15,17 @@ class SeasonsController extends Controller
|
|||
if (Auth::guest()) { return redirect("/"); }
|
||||
if (!Auth::user()->admin) { return redirect("/"); }
|
||||
|
||||
|
||||
|
||||
$seasons = DB::table('seasons')->get();
|
||||
$activeSeason=Season::getCurrent();
|
||||
|
||||
Log::info("Creating default quota");
|
||||
Quota::createDefaultQuota($activeSeason->id);
|
||||
|
||||
return view('seasons.index', compact('seasons','activeSeason'));
|
||||
}
|
||||
|
||||
|
||||
public function create() {
|
||||
if (Auth::guest()) { return redirect("/"); }
|
||||
if (!Auth::user()->admin) { return redirect("/"); }
|
||||
|
|
@ -52,7 +58,6 @@ class SeasonsController extends Controller
|
|||
return redirect('/seasons');
|
||||
}
|
||||
|
||||
|
||||
public function setcurrent($new_season_id) {
|
||||
if (Auth::guest()) { return redirect("/"); }
|
||||
if (!Auth::user()->admin) { return redirect("/"); }
|
||||
|
|
@ -61,4 +66,4 @@ class SeasonsController extends Controller
|
|||
return redirect("/seasons");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
116
pfosten/app/Quota.php
Normal file
116
pfosten/app/Quota.php
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Log;
|
||||
use DB;
|
||||
|
||||
class Quota extends Model
|
||||
{
|
||||
public static function createDefaultQuota($season_id)
|
||||
{
|
||||
|
||||
DB::table('quotas')->where('season_id', '=', $season_id)->delete();
|
||||
|
||||
Log::info("Creating new Quota");
|
||||
$quota = new Quota;
|
||||
$quota->season_id = $season_id;
|
||||
$quota->qtype = "SPIELMODUS";
|
||||
$quota->name = "Tagessieg";
|
||||
$quota->prc = 50;
|
||||
$quota->save();
|
||||
|
||||
|
||||
$quota = new Quota;
|
||||
$quota->season_id = $season_id;
|
||||
$quota->qtype = "SPIELMODUS";
|
||||
$quota->name = "Rangsieg";
|
||||
$quota->prc = 50;
|
||||
$quota->save();
|
||||
|
||||
/// #######################################
|
||||
|
||||
// Sub-Quotas für den Spielmodus 'Tagessieg'
|
||||
|
||||
$quota = new Quota;
|
||||
$quota->season_id = $season_id;
|
||||
$quota->qtype = "PLATZIERUNG";
|
||||
$quota->name = "Platz 1";
|
||||
$quota->order = 1;
|
||||
$quota->prc = 21;
|
||||
$quota->save();
|
||||
|
||||
$quota = new Quota;
|
||||
$quota->season_id = $season_id;
|
||||
$quota->qtype = "PLATZIERUNG";
|
||||
$quota->name = "Platz 2";
|
||||
$quota->order = 2;
|
||||
$quota->prc = 17;
|
||||
$quota->save();
|
||||
|
||||
$quota = new Quota;
|
||||
$quota->season_id = $season_id;
|
||||
$quota->qtype = "PLATZIERUNG";
|
||||
$quota->name = "Platz 3";
|
||||
$quota->order = 3;
|
||||
$quota->prc = 13;
|
||||
$quota->save();
|
||||
|
||||
$quota = new Quota;
|
||||
$quota->season_id = $season_id;
|
||||
$quota->qtype = "PLATZIERUNG";
|
||||
$quota->name = "Platz 4";
|
||||
$quota->order = 4;
|
||||
$quota->prc = 10;
|
||||
$quota->save();
|
||||
|
||||
$quota = new Quota;
|
||||
$quota->season_id = $season_id;
|
||||
$quota->qtype = "PLATZIERUNG";
|
||||
$quota->name = "Platz 5";
|
||||
$quota->order = 5;
|
||||
$quota->prc = 9;
|
||||
$quota->save();
|
||||
|
||||
$quota = new Quota;
|
||||
$quota->season_id = $season_id;
|
||||
$quota->qtype = "PLATZIERUNG";
|
||||
$quota->name = "Platz 6";
|
||||
$quota->order = 6;
|
||||
$quota->prc = 8;
|
||||
$quota->save();
|
||||
|
||||
$quota = new Quota;
|
||||
$quota->season_id = $season_id;
|
||||
$quota->qtype = "PLATZIERUNG";
|
||||
$quota->name = "Platz 7";
|
||||
$quota->order = 7;
|
||||
$quota->prc = 7;
|
||||
$quota->save();
|
||||
|
||||
$quota = new Quota;
|
||||
$quota->season_id = $season_id;
|
||||
$quota->qtype = "PLATZIERUNG";
|
||||
$quota->name = "Platz 8";
|
||||
$quota->order = 8;
|
||||
$quota->prc = 6;
|
||||
$quota->save();
|
||||
|
||||
$quota = new Quota;
|
||||
$quota->season_id = $season_id;
|
||||
$quota->qtype = "PLATZIERUNG";
|
||||
$quota->name = "Platz 9";
|
||||
$quota->order = 9;
|
||||
$quota->prc = 5;
|
||||
$quota->save();
|
||||
|
||||
$quota = new Quota;
|
||||
$quota->season_id = $season_id;
|
||||
$quota->qtype = "PLATZIERUNG";
|
||||
$quota->name = "Platz 10";
|
||||
$quota->order = 10;
|
||||
$quota->prc = 4;
|
||||
$quota->save();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue