Laravel\PlatformServiceProvider

Netson\Platform\Laravel\PlatformServiceProvider · All classes

Binds NetsonCloud and feeds auth events to the security feed. register() does no filesystem access, so artisan event:cache works on a build host without a config.

Example

function registerPlatformLibrary(Application $app, string $library): bool
{
    // Platform hosts only: on a laptop or build machine the file is absent.
    if (!is_file($library)) {
        return false;
    }

    try {
        require_once $library;
        if (class_exists(PlatformServiceProvider::class)) {
            $app->register(PlatformServiceProvider::class);

            return true;
        }
    } catch (\Throwable) {
        // A broken library disables the feed, never the app.
    }

    return false;
}

Methods

register()

public function register(): void

Binds NetsonCloud for this app (also as 'netson.cloud') in the container.

See the example at the top of this page.

boot()

public function boot(): void

Listens to Laravel's auth events and records them in the site's security feed.

See the example at the top of this page.