Skip to content

Commit

Permalink
Update PageController
Browse files Browse the repository at this point in the history
  • Loading branch information
dansup committed Jun 19, 2019
1 parent a3be4cd commit ef3e30d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions app/Http/Controllers/PageController.php
Expand Up @@ -50,4 +50,29 @@ public function store(Request $request)
$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'));
}
}

0 comments on commit ef3e30d

Please sign in to comment.