diff --git a/pfosten/app/Http/Controllers/RoundsController.php b/pfosten/app/Http/Controllers/RoundsController.php index 6e73fe46..1bcd73b3 100644 --- a/pfosten/app/Http/Controllers/RoundsController.php +++ b/pfosten/app/Http/Controllers/RoundsController.php @@ -9,6 +9,7 @@ use App\Game; use App\User; use DB; use Auth; +use Log; class RoundsController extends Controller { @@ -107,6 +108,34 @@ class RoundsController extends Controller return redirect('/rounds'); } + public function store_report() { + if (Auth::guest()) { return redirect("/"); } + if (!Auth::user()->admin) { return redirect("/"); } + + // Validate form + $this->validate(request(), [ + 'round_id' => 'required', + 'report' => 'required' + ]); + + $seasonId = Season::getCurrent()->id; + + $round = Round::where('id','=',request('round_id'))->first(); + + //Log::info("Report = ".request("report")); + + + $round->report = request("report"); + $round->save(); + + + // Redirect to the home page + return redirect('/rounds'); + } + + + + public function editname($round_id) { $round = Round::where('id', $round_id)->first(); diff --git a/pfosten/database/migrations/2017_06_19_112646_create_rounds_table.php b/pfosten/database/migrations/2017_06_19_112646_create_rounds_table.php index a77a62fd..280809b9 100644 --- a/pfosten/database/migrations/2017_06_19_112646_create_rounds_table.php +++ b/pfosten/database/migrations/2017_06_19_112646_create_rounds_table.php @@ -17,6 +17,7 @@ class CreateRoundsTable extends Migration $table->increments('id'); $table->string('name',64); $table->integer('season_id'); + $table->string('report',16000)->default(''); $table->timestamps(); }); } diff --git a/pfosten/resources/views/rounds/index.blade.php b/pfosten/resources/views/rounds/index.blade.php index fbb479b0..f7a547b9 100755 --- a/pfosten/resources/views/rounds/index.blade.php +++ b/pfosten/resources/views/rounds/index.blade.php @@ -4,42 +4,60 @@
- -
Runden
-
Runde hinzufügen
+
Runden
+
Runde hinzufügen

 

-
- @foreach($rounds->reverse() as $round) -
{{ $round->name }}
- - - - - - - -

 

- - @foreach($round->games as $game) - - - - - - @endforeach - -
SpielAnstossErgebnis
 {{$game->team1 . " : " . $game->team2}}  {{App\User::toGermanDate($game->kickoff)}} {{ App\Game::resultString( $game->id ) }}  
-

 

- @endforeach - -
- -
+
+ + @foreach($rounds->reverse() as $round) +
{{ $round->name }}
+ + + + + + + +

 

+ @foreach($round->games as $game) + + + + + + @endforeach + +
SpielAnstossErgebnis
 {{$game->team1 . " : " . $game->team2}}  {{App\User::toGermanDate($game->kickoff)}} {{ App\Game::resultString( $game->id ) }}  
+
+ + +
+

! 

+ + +

Berichterstattung

+ + +
+ {{ csrf_field() }} + + + + +

+
+ +
+
+ +

 

+ @endforeach +
@endsection diff --git a/pfosten/routes/web.php b/pfosten/routes/web.php index fff52391..3f691508 100644 --- a/pfosten/routes/web.php +++ b/pfosten/routes/web.php @@ -30,6 +30,7 @@ Route::get('/seasons/setcurrent/{new_season_id}','SeasonsController@setcurrent') Route::get('/rounds','RoundsController@index'); Route::get('/rounds/create','RoundsController@create'); Route::post('/rounds/store','RoundsController@store'); +Route::post('/rounds/store_report','RoundsController@store_report'); Route::get('/rounds/editname/{round_id}','RoundsController@editname'); Route::post('/rounds/storename', 'RoundsController@storename'); @@ -46,4 +47,4 @@ Route::get('/users/ranking/{round_id}','UsersController@ranking'); Route::get('/tipps','TippsController@index'); Route::get('/tipps/edit/{tipp_id}','TippsController@edit'); -Route::post('/tipps/store','TippsController@store'); \ No newline at end of file +Route::post('/tipps/store','TippsController@store');