'Notice',
'type' => 'placeholder',
'label' => new HtmlString(
'Use this extension to create Custom Pages like a ToS, FAQ or Privacy Policy.
Manage your Pages at Custom Pages.
Need help? Join our Discord at https://discord.gg/V3nJ3jVURN'
),
],
];
} catch (\Exception $e) {
return [
[
'name' => 'Notice',
'type' => 'placeholder',
'label' => new HtmlString(
'Use this extension to create Custom Pages like a ToS, FAQ or Privacy Policy. You will need to enable it before you can use it.
Need help? Join our Discord at https://discord.gg/V3nJ3jVURN'
),
],
];
}
}
public function enabled()
{
Artisan::call('migrate', [
'--path' => 'extensions/Others/CustomPages/database/migrations',
'--force' => true,
]);
}
public function boot()
{
require __DIR__ . '/routes/web.php';
View::addNamespace('custompages', __DIR__ . '/resources/views');
\Livewire\Livewire::component('custompages.show', \Paymenter\Extensions\Others\CustomPages\Livewire\Show::class);
Event::listen('navigation', function () {
return Page::where('visible_in_menu', true)
->where('is_active', true)
->whereNotNull('slug')
->where('slug', '!=', '')
->get()
->filter(function ($page) {
switch ($page->visibility) {
case 'admins':
if (!Auth::check() || is_null(Auth::user()->role)) {
return false;
}
break;
case 'customers':
if (!Auth::check() || !is_null(Auth::user()->role)) {
return false;
}
break;
case 'guests':
if (Auth::check()) {
return false;
}
break;
case 'logged-in':
if (!Auth::check()) {
return false;
}
break;
case 'everyone':
default:
// everyone mag zien
break;
}
return true; // fucked up
})
->map(function ($page) {
return [
'route' => 'custompages.show',
'name' => $page->title,
'params' => ['fallbackPlaceholder' => $page->slug],
'icon' => 'ri-pages',
];
})
->toArray();
});
}
}