Rangliste almost done
This commit is contained in:
parent
12651fc2e8
commit
43fd8c8cbf
579 changed files with 172489 additions and 127 deletions
|
|
@ -5,10 +5,15 @@ namespace App\Http\Controllers;
|
|||
use Illuminate\Http\Request;
|
||||
use App\Season;
|
||||
use DB;
|
||||
use Auth;
|
||||
use Log;
|
||||
|
||||
class SeasonsController extends Controller
|
||||
{
|
||||
public function index() {
|
||||
if (Auth::guest()) { return redirect("/"); }
|
||||
if (!Auth::user()->admin) { return redirect("/"); }
|
||||
|
||||
$seasons = DB::table('seasons')->get();
|
||||
$activeSeason=Season::getCurrent();
|
||||
return view('seasons.index', compact('seasons','activeSeason'));
|
||||
|
|
@ -16,11 +21,15 @@ class SeasonsController extends Controller
|
|||
|
||||
|
||||
public function create() {
|
||||
if (Auth::guest()) { return redirect("/"); }
|
||||
if (!Auth::user()->admin) { return redirect("/"); }
|
||||
|
||||
return view('seasons.create');
|
||||
}
|
||||
|
||||
public function store() {
|
||||
if (Auth::guest()) { return redirect("/"); }
|
||||
if (!Auth::user()->admin) { return redirect("/"); }
|
||||
|
||||
// Validate form
|
||||
$this->validate(request(), [
|
||||
|
|
@ -33,9 +42,23 @@ class SeasonsController extends Controller
|
|||
'name' => request('name')
|
||||
]);
|
||||
|
||||
if (Season::all()->count()==1) {
|
||||
Season::setCurrent($season->id);
|
||||
Log::info('Setting season id=' .$season->id);
|
||||
}
|
||||
|
||||
|
||||
// Redirect to the home page
|
||||
return redirect('/seasons');
|
||||
}
|
||||
|
||||
|
||||
public function setcurrent($new_season_id) {
|
||||
if (Auth::guest()) { return redirect("/"); }
|
||||
if (!Auth::user()->admin) { return redirect("/"); }
|
||||
|
||||
Season::setCurrent($new_season_id);
|
||||
return redirect("/seasons");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue