class RouteServiceProvider extends ServiceProvider mixin Router (View source)

Traits

Properties

protected Application $app

The application instance.

from  ServiceProvider
protected array $bootingCallbacks

All of the registered booting callbacks.

from  ServiceProvider
protected array $bootedCallbacks

All of the registered booted callbacks.

from  ServiceProvider
static array $publishes

The paths that should be published.

from  ServiceProvider
static array $publishGroups

The paths that should be published by group.

from  ServiceProvider
static protected array $publishableMigrationPaths

The migration paths available for publishing.

from  ServiceProvider
static array<string,string> $optimizeCommands

Commands that should be run during the "optimize" command.

from  ServiceProvider
static array<string,string> $optimizeClearCommands

Commands that should be run during the "optimize:clear" command.

from  ServiceProvider
array<string,string> $bindings

All of the container bindings that should be registered.

from  ServiceProvider
array<array-key,string> $singletons

All of the singletons that should be registered.

from  ServiceProvider
protected string|null $namespace

The controller namespace for the application.

protected Closure|null $loadRoutesUsing

The callback that should be used to load the application's routes.

static protected Closure|null $alwaysLoadRoutesUsing

The global callback that should be used to load the application's routes.

static protected Closure|null $alwaysLoadCachedRoutesUsing

The callback that should be used to load the application's cached routes.

Methods

void
__construct(Application $app)

Create a new service provider instance.

void
register()

Register any application services.

void
booting(Closure $callback)

Register a booting callback to be run before the "boot" method is called.

void
booted(Closure $callback)

Register a booted callback to be run after the "boot" method is called.

void
callBootingCallbacks()

Call the registered booting callbacks.

void
callBootedCallbacks()

Call the registered booted callbacks.

void
mergeConfigFrom(string $path, string $key)

Merge the given configuration with the existing configuration.

void
replaceConfigRecursivelyFrom(string $path, string $key)

Replace the given configuration with the existing configuration recursively.

void
loadRoutesFrom(string $path)

Load the given routes file if routes are not already cached.

void
loadViewsFrom(string|array $path, string $namespace)

Register a view file namespace.

void
loadViewComponentsAs(string $prefix, array $components)

Register the given view components with a custom prefix.

void
loadTranslationsFrom(string $path, string $namespace)

Register a translation file namespace.

void
loadJsonTranslationsFrom(string $path)

Register a JSON translation file path.

void
loadMigrationsFrom(array|string $paths)

Register database migration paths.

void
loadFactoriesFrom(array|string $paths) deprecated

Register Eloquent model factory paths.

void
callAfterResolving(string $name, callable $callback)

Setup an after resolving listener, or fire immediately if already resolved.

void
publishesMigrations(array $paths, mixed $groups = null)

Register migration paths to be published by the publish command.

void
publishes(array $paths, mixed $groups = null)

Register paths to be published by the publish command.

void
ensurePublishArrayInitialized(string $class)

Ensure the publish array for the service provider is initialized.

void
addPublishGroup(string $group, array $paths)

Add a publish group / tag to the service provider.

static array
pathsToPublish(string|null $provider = null, string|null $group = null)

Get the paths to publish.

static array
pathsForProviderOrGroup(string|null $provider, string|null $group)

Get the paths for the provider or group (or both).

static array
pathsForProviderAndGroup(string $provider, string $group)

Get the paths for the provider and group.

static array
publishableProviders()

Get the service providers available for publishing.

static array
publishableMigrationPaths()

Get the migration paths available for publishing.

static array
publishableGroups()

Get the groups available for publishing.

void
commands(array|mixed $commands)

Register the package's custom Artisan commands.

void
optimizes(string|null $optimize = null, string|null $clear = null, string|null $key = null)

Register commands that should run on "optimize" or "optimize:clear".

array
provides()

Get the services provided by the provider.

array
when()

Get the events that trigger this service provider to register.

bool
isDeferred()

Determine if the provider is deferred.

defaultProviders()

Get the default providers for a Laravel application.

static bool
addProviderToBootstrapFile(string $provider, string|null $path = null)

Add the given provider to the application's provider bootstrap file.

mixed
forwardCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object.

mixed
forwardDecoratedCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object, returning $this if the forwarded call returned itself.

static never
throwBadMethodCallException(string $method)

Throw a bad method call exception for the given method.

void
boot()

Bootstrap any application services.

$this
routes(Closure $routesCallback)

Register the callback that will be used to load the application's routes.

static void
loadRoutesUsing(Closure|null $routesCallback)

Register the callback that will be used to load the application's routes.

static void
loadCachedRoutesUsing(Closure|null $routesCallback)

Register the callback that will be used to load the application's cached routes.

void
setRootControllerNamespace()

Set the root controller namespace for the application.

bool
routesAreCached()

Determine if the application routes are cached.

void
loadCachedRoutes()

Load the cached routes for the application.

void
loadRoutes()

Load the application routes.

mixed
__call(string $method, array $parameters)

Pass dynamic methods onto the router instance.

Details

void __construct(Application $app)

Create a new service provider instance.

Parameters

Application $app

Return Value

void

void register()

Register any application services.

Return Value

void

void booting(Closure $callback)

Register a booting callback to be run before the "boot" method is called.

Parameters

Closure $callback

Return Value

void

void booted(Closure $callback)

Register a booted callback to be run after the "boot" method is called.

Parameters

Closure $callback

Return Value

void

void callBootingCallbacks()

Call the registered booting callbacks.

Return Value

void

void callBootedCallbacks()

Call the registered booted callbacks.

Return Value

void

protected void mergeConfigFrom(string $path, string $key)

Merge the given configuration with the existing configuration.

Parameters

string $path
string $key

Return Value

void

protected void replaceConfigRecursivelyFrom(string $path, string $key)

Replace the given configuration with the existing configuration recursively.

Parameters

string $path
string $key

Return Value

void

protected void loadRoutesFrom(string $path)

Load the given routes file if routes are not already cached.

Parameters

string $path

Return Value

void

protected void loadViewsFrom(string|array $path, string $namespace)

Register a view file namespace.

Parameters

string|array $path
string $namespace

Return Value

void

protected void loadViewComponentsAs(string $prefix, array $components)

Register the given view components with a custom prefix.

Parameters

string $prefix
array $components

Return Value

void

protected void loadTranslationsFrom(string $path, string $namespace)

Register a translation file namespace.

Parameters

string $path
string $namespace

Return Value

void

protected void loadJsonTranslationsFrom(string $path)

Register a JSON translation file path.

Parameters

string $path

Return Value

void

protected void loadMigrationsFrom(array|string $paths)

Register database migration paths.

Parameters

array|string $paths

Return Value

void

protected void loadFactoriesFrom(array|string $paths) deprecated

deprecated Will be removed in a future Laravel version.

Register Eloquent model factory paths.

Parameters

array|string $paths

Return Value

void

protected void callAfterResolving(string $name, callable $callback)

Setup an after resolving listener, or fire immediately if already resolved.

Parameters

string $name
callable $callback

Return Value

void

protected void publishesMigrations(array $paths, mixed $groups = null)

Register migration paths to be published by the publish command.

Parameters

array $paths
mixed $groups

Return Value

void

protected void publishes(array $paths, mixed $groups = null)

Register paths to be published by the publish command.

Parameters

array $paths
mixed $groups

Return Value

void

protected void ensurePublishArrayInitialized(string $class)

Ensure the publish array for the service provider is initialized.

Parameters

string $class

Return Value

void

protected void addPublishGroup(string $group, array $paths)

Add a publish group / tag to the service provider.

Parameters

string $group
array $paths

Return Value

void

static array pathsToPublish(string|null $provider = null, string|null $group = null)

Get the paths to publish.

Parameters

string|null $provider
string|null $group

Return Value

array

static protected array pathsForProviderOrGroup(string|null $provider, string|null $group)

Get the paths for the provider or group (or both).

Parameters

string|null $provider
string|null $group

Return Value

array

static protected array pathsForProviderAndGroup(string $provider, string $group)

Get the paths for the provider and group.

Parameters

string $provider
string $group

Return Value

array

static array publishableProviders()

Get the service providers available for publishing.

Return Value

array

static array publishableMigrationPaths()

Get the migration paths available for publishing.

Return Value

array

static array publishableGroups()

Get the groups available for publishing.

Return Value

array

void commands(array|mixed $commands)

Register the package's custom Artisan commands.

Parameters

array|mixed $commands

Return Value

void

protected void optimizes(string|null $optimize = null, string|null $clear = null, string|null $key = null)

Register commands that should run on "optimize" or "optimize:clear".

Parameters

string|null $optimize
string|null $clear
string|null $key

Return Value

void

array provides()

Get the services provided by the provider.

Return Value

array

array when()

Get the events that trigger this service provider to register.

Return Value

array

bool isDeferred()

Determine if the provider is deferred.

Return Value

bool

static DefaultProviders defaultProviders()

Get the default providers for a Laravel application.

Return Value

DefaultProviders

static bool addProviderToBootstrapFile(string $provider, string|null $path = null)

Add the given provider to the application's provider bootstrap file.

Parameters

string $provider
string|null $path

Return Value

bool

protected mixed forwardCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object.

Parameters

mixed $object
string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

protected mixed forwardDecoratedCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object, returning $this if the forwarded call returned itself.

Parameters

mixed $object
string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

static protected never throwBadMethodCallException(string $method)

Throw a bad method call exception for the given method.

Parameters

string $method

Return Value

never

Exceptions

BadMethodCallException

void boot()

Bootstrap any application services.

Return Value

void

protected $this routes(Closure $routesCallback)

Register the callback that will be used to load the application's routes.

Parameters

Closure $routesCallback

Return Value

$this

static void loadRoutesUsing(Closure|null $routesCallback)

Register the callback that will be used to load the application's routes.

Parameters

Closure|null $routesCallback

Return Value

void

static void loadCachedRoutesUsing(Closure|null $routesCallback)

Register the callback that will be used to load the application's cached routes.

Parameters

Closure|null $routesCallback

Return Value

void

protected void setRootControllerNamespace()

Set the root controller namespace for the application.

Return Value

void

protected bool routesAreCached()

Determine if the application routes are cached.

Return Value

bool

protected void loadCachedRoutes()

Load the cached routes for the application.

Return Value

void

protected void loadRoutes()

Load the application routes.

Return Value

void

mixed __call(string $method, array $parameters)

Pass dynamic methods onto the router instance.

Parameters

string $method
array $parameters

Return Value

mixed