mirror of
https://github.com/LinkStackOrg/LinkStack.git
synced 2025-01-10 17:23:12 +01:00
Disabling footer pages when inactive in config
Footer pages now return an error 404 when disabled in the config.
This commit is contained in:
parent
72387e609e
commit
ab1557110d
@ -315,16 +315,27 @@ class AdminController extends Controller
|
||||
}
|
||||
|
||||
//View any of the pages: contact, terms, privacy
|
||||
public function pages(request $request)
|
||||
public function pages(Request $request)
|
||||
{
|
||||
$name = $request->name;
|
||||
|
||||
|
||||
$enabledPages = [
|
||||
'contact' => env('DISPLAY_FOOTER_CONTACT', false),
|
||||
'terms' => env('DISPLAY_FOOTER_TERMS', false),
|
||||
'privacy' => env('DISPLAY_FOOTER_PRIVACY', false),
|
||||
// Add other pages here as needed
|
||||
];
|
||||
|
||||
if (!array_key_exists($name, $enabledPages) || !$enabledPages[$name]) {
|
||||
return abort(404);
|
||||
}
|
||||
|
||||
try {
|
||||
$data['page'] = Page::select($name)->first();
|
||||
} catch (Exception $e) {
|
||||
return abort(404);
|
||||
}
|
||||
|
||||
|
||||
return view('pages', ['data' => $data, 'name' => $name]);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user