added Orte-Table

This commit is contained in:
chrosey
2017-07-08 10:26:50 +02:00
parent 8b98db74a2
commit 8cfa2762db
9 changed files with 109 additions and 3557 deletions
@@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use App\Veranstaltung;
use App\Eintragung;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
@@ -66,8 +67,9 @@ class VeranstaltungController extends Controller
*/
public function show(Veranstaltung $veranstaltung)
{
if ($veranstaltung->has('eintragungen')) {
$veranstaltung->eintragungen;
$veranstaltung = $veranstaltung->with('eintragungen.user')->find($veranstaltung->id);
}
return view('veranstaltung.show', $veranstaltung);
}
@@ -124,6 +126,12 @@ class VeranstaltungController extends Controller
public function enter(Request $request, Veranstaltung $veranstaltung)
{
$eintragung = new Eintragung();
$eintragung->veranstaltung()->associate($veranstaltung);
$eintragung->user()->associate(\Auth::user());
if($eintragung->save()){
return redirect()->route('veranstaltung.index');
}
return response()->json($eintragung);
}
}