Hoschis Vollpfosten First Commit
This commit is contained in:
parent
b52a6fade5
commit
0736ecf29f
112 changed files with 9777 additions and 0 deletions
41
pfosten/app/Http/Controllers/SeasonsController.php
Normal file
41
pfosten/app/Http/Controllers/SeasonsController.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Season;
|
||||
use DB;
|
||||
|
||||
class SeasonsController extends Controller
|
||||
{
|
||||
public function index() {
|
||||
$seasons = DB::table('seasons')->get();
|
||||
$activeSeason=Season::getCurrent();
|
||||
return view('seasons.index', compact('seasons','activeSeason'));
|
||||
}
|
||||
|
||||
|
||||
public function create() {
|
||||
|
||||
return view('seasons.create');
|
||||
}
|
||||
|
||||
public function store() {
|
||||
|
||||
// Validate form
|
||||
$this->validate(request(), [
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
// Create and save the season
|
||||
|
||||
$season = Season::create([
|
||||
'name' => request('name')
|
||||
]);
|
||||
|
||||
|
||||
// Redirect to the home page
|
||||
return redirect('/seasons');
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue