From 9d1a810fa983a045294e6d0b8ad761f5dbfb8939 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Wed, 5 Dec 2018 17:31:36 +0100 Subject: Initial commit (actually already finished) --- routes/web.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 routes/web.php (limited to 'routes/web.php') diff --git a/routes/web.php b/routes/web.php new file mode 100644 index 0000000..67ff691 --- /dev/null +++ b/routes/web.php @@ -0,0 +1,48 @@ +get(); + + return view('quotes', [ + 'quotes' => $quotes + ]); +}); + +/** + * Add a new quote + */ +Route::post('/quote', function (Request $request) { + $validator = Validator::make($request->all(), [ + 'quote' => 'required|max:1023', + 'quotist' => 'required|max:63', + ]); + + if ($validator->fails()) { + return redirect('/') + ->withInput() + ->withErrors($validator); + } + + $quote = new \App\Quote; + $quote->quote = $request->quote; + $quote->quotist = $request->quotist; + $quote->save(); + + //return redirect('/'); +}); -- cgit v1.2.3