From ef3e30dbb8184518c5b3f19e7efdd6e51439022f Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 19 Jun 2019 14:30:33 -0600 Subject: [PATCH] Update PageController --- app/Http/Controllers/PageController.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/app/Http/Controllers/PageController.php b/app/Http/Controllers/PageController.php index f1e78d7f9..101f981b2 100644 --- a/app/Http/Controllers/PageController.php +++ b/app/Http/Controllers/PageController.php @@ -50,4 +50,29 @@ class PageController extends Controller $page->save(); return response()->json(['msg' => 200]); } + + public function generatePage(Request $request) + { + $this->validate($request, [ + 'page' => 'required|string|in:about,terms,privacy', + ]); + + $page = $request->input('page'); + + switch ($page) { + case 'about': + Page::firstOrCreate(['slug' => '/site/about']); + break; + + case 'privacy': + Page::firstOrCreate(['slug' => '/site/privacy']); + break; + + case 'terms': + Page::firstOrCreate(['slug' => '/site/terms']); + break; + } + + return redirect(route('admin.settings.pages')); + } }