Rangliste almost done
This commit is contained in:
parent
12651fc2e8
commit
43fd8c8cbf
579 changed files with 172489 additions and 127 deletions
|
|
@ -4,6 +4,7 @@ namespace App;
|
|||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use \App\Setting;
|
||||
use Log;
|
||||
|
||||
class Season extends Model
|
||||
{
|
||||
|
|
@ -17,6 +18,28 @@ class Season extends Model
|
|||
*/
|
||||
|
||||
public static function getCurrent() {
|
||||
return \App\Season::orderBy('id','desc')->where('active','=','1')->first();
|
||||
$setting = Setting::all()->first();
|
||||
if (!$setting) {
|
||||
//Log::info('Season.getCurrent(): No current season set');
|
||||
return null;
|
||||
}
|
||||
|
||||
//Log::info("current_season_id=" . $setting->current_season_id);
|
||||
$currentSeason = Season::where('id',$setting->current_season_id)->first();
|
||||
|
||||
return $currentSeason;
|
||||
}
|
||||
|
||||
|
||||
public static function setCurrent($season_id) {
|
||||
|
||||
$setting = Setting::all()->first();
|
||||
if (!$setting) {
|
||||
$setting = Setting::create([
|
||||
'current_season_id' => $season_id
|
||||
]);
|
||||
}
|
||||
$setting->current_season_id=$season_id;
|
||||
$setting->save();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue