mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-03-31 15:07:47 +01:00
chore: add Laravel excluded paths option
This commit is contained in:
@@ -227,10 +227,13 @@ final class FlasherServiceProvider extends PluginServiceProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->app->singleton(FlasherMiddleware::class, static function (Application $app) {
|
$this->app->singleton(FlasherMiddleware::class, static function (Application $app) {
|
||||||
|
$config = $app->make('config');
|
||||||
|
|
||||||
$flasher = $app->make('flasher');
|
$flasher = $app->make('flasher');
|
||||||
$cspHandler = $app->make('flasher.csp_handler');
|
$cspHandler = $app->make('flasher.csp_handler');
|
||||||
|
$excludedPaths = $config->get('flasher.excluded_paths', []) ?: [];
|
||||||
|
|
||||||
return new FlasherMiddleware(new ResponseExtension($flasher, $cspHandler));
|
return new FlasherMiddleware(new ResponseExtension($flasher, $cspHandler, $excludedPaths));
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->pushMiddlewareToGroup(FlasherMiddleware::class);
|
$this->pushMiddlewareToGroup(FlasherMiddleware::class);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ namespace Illuminate\Contracts\Config;
|
|||||||
* scripts: string[],
|
* scripts: string[],
|
||||||
* styles: string[],
|
* styles: string[],
|
||||||
* options: array<string, mixed>,
|
* options: array<string, mixed>,
|
||||||
|
* excluded_paths?: list<non-empty-string>,
|
||||||
* filter: array<string, mixed>,
|
* filter: array<string, mixed>,
|
||||||
* flash_bag: array<string, string[]>,
|
* flash_bag: array<string, string[]>,
|
||||||
* presets: array<string, PresetType>,
|
* presets: array<string, PresetType>,
|
||||||
@@ -44,6 +45,7 @@ interface Repository
|
|||||||
* ($key is 'flasher.presets' ? array<string, PresetType> :
|
* ($key is 'flasher.presets' ? array<string, PresetType> :
|
||||||
* ($key is 'flasher.plugins' ? array<string, PluginType> :
|
* ($key is 'flasher.plugins' ? array<string, PluginType> :
|
||||||
* ($key is 'flasher.flash_bag' ? array<string, string[]> :
|
* ($key is 'flasher.flash_bag' ? array<string, string[]> :
|
||||||
|
* ($key is 'flasher.excluded_paths' ? list<non-empty-string> :
|
||||||
* mixed)))))))
|
* mixed)))))))
|
||||||
*/
|
*/
|
||||||
public function get(string|array $key, mixed $default = null): mixed;
|
public function get(string|array $key, mixed $default = null): mixed;
|
||||||
|
|||||||
Reference in New Issue
Block a user