Download the PHP package stechstudio/laravel-route-context without Composer
On this page you can find all versions of the php package stechstudio/laravel-route-context. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stechstudio/laravel-route-context
More information about stechstudio/laravel-route-context
Files in stechstudio/laravel-route-context
Package laravel-route-context
Short Description Provide additional route context that gets treated as normal route parameters
License MIT
Homepage https://github.com/stechstudio/laravel-route-context
Informations about the package laravel-route-context
Route context in Laravel
This is a super small package that enables you to provide additional context to your routes. Any context variables you specify will be treated as route parameters.
Installation
You know the drill...
Usage
The idea is that sometimes you want to reuse a controller method or Livewire fullpage component, while providing additional context at the routing layer.
Imagine you need to list support tickets, and you have a controller and view that handles this. You have multiple endpoints where tickets might be displayed in a slightly different manner.
With this package you can specify additional context right alongside your routes like this:
Now in your TicketController
you can inject your context variables, just as if they had been route parameters:
Notice that context values can be callbacks, if you need it evaluated after your app has bootstrapped, session is started, auth is available, etc.
License
The MIT License (MIT). Please see License File for more information.