Skip to content

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.

php
    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:

php
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     false

Example

php
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     true

Example

php
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     true

Example

php
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     false

Example

php
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

php
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

php
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.

php
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

php
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/callback

Add this part to config/services.php

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'),
    ],