Qore admin base features
Introduction
To be able to set features of Qore.admin base, make sure you add the QoreAdminBasePlugin::make() plugin, with the desired options, to the plugins section of the panel in the application service provider.
public function panel(QorePanel|Panel $panel): QorePanel
{
return parent::panel($panel)
->default()
->id('admin')
->path('admin')
->authGuard('qore')
->authPasswordBroker('qore')
->plugins([
QoreAdminBasePlugin::make()->setProfilePage(false),
QoreRelationPlugin::make(),
// ...
])
);
}To get access to the features outside the plugin class, you can use the following:
QoreAdminBasePlugin::get()->assetResourceIsActive()Assets
Show/hide the asset resource in the menu
Possible values
true Show the default asset resource
false Don't shouw the asset resource
classname Show a custom asset resource
default falseExample
QoreAdminBasePlugin::make()->setAssetResource(true)Profile page
Show/hide the profile page in the user menu
Possible values
true Show the default profile page
false Don't show the profile page in the users manu
classname Show a custom page as profile page
default trueExample
QoreAdminBasePlugin::make()->setProfilePage()Dashboard page
Show/hide the dashboard page in the menu
Possible values
true Show the default dashboard page
false Don't use a (default) dashboard page
classname Show a custom page as dashboard page
default trueExample
QoreAdminBasePlugin::make()->setDashboardPage()FAQ
Show/hide the FAQ resource in the menu
Possible values`
true Show the default FAQ resource
false Don't shouw the FAQ resource
classname Show a custom FAQ resource
default falseExample
QoreAdminBasePlugin::make()->setFaqResource(true)Booting
If you want to boot addition policies or other setup that needs to happen for filament only.
Possible values`
callable A Closure that adds policy or other booting.
callable.panel The first argument contains the Filament panel being booted
returns null or callable response.Example
QoreAdminBasePlugin::make()->setExtendedBootFunction(function(Panel $panel) {
Gate::policy(Role::class, MyRolePolicy::class);
})Single Sign-On (SSO)
If you want to enable Single Sign-On in your application add the plugin to the plugins() section of the applications panel service provider
Example
QoreAdminBasePlugin::make()->setEnableSsoAuthentication(true)Google
For Google you need to set the redirect URL. Make sure it is configured as /admin/login/auth/google/callback as this is how the routes are specified in the QoreAdminBasePlugin.
Route::middleware(['web'])
->prefix('/admin/login/auth/')
->group(function () {
Route::get('{provider}/redirect', [SocialiteController::class, 'redirect'])
->whereIn('provider', config('qore.sso.providers'))
->name('socialite.redirect');
Route::get('{provider}/callback', [SocialiteController::class, 'callback'])
->whereIn('provider', config('qore.sso.providers'))
->name('socialite.callback');When SSO is enabled, you are able to specify SSO providers and allow SSO only for specific domains. Both are configured via the .env file.
.env example configuration
SSO_PROVIDERS=google
ALLOWED_DOMAINS=dolphiq.nl, example.com
GOOGLE_SSO_CLIENT_ID=xxxx xxxx xxxx
GOOGLE_SSO_CLIENT_SECRET=xxxx xxxx xxxx
GOOGLE_SSO_REDIRECT_URL=/admin/login/auth/google/callbackAdd this part to config/services.php
'google' => [
'client_id' => env('GOOGLE_SSO_CLIENT_ID'),
'client_secret' => env('GOOGLE_SSO_CLIENT_SECRET'),
'redirect' => env('GOOGLE_SSO_REDIRECT_URL', '/admin/login/auth/google/callback'),
],