fix: Correctly disable FlasherMiddleware when inject_assets is set to false

This commit is contained in:
Younes ENNAJI
2024-05-22 22:48:17 +01:00
parent c0709b0747
commit bbccf0bc4e
3 changed files with 19 additions and 0 deletions
@@ -6,6 +6,7 @@ namespace Flasher\Laravel\Support;
use Flasher\Prime\Factory\NotificationFactoryLocator;
use Flasher\Prime\Plugin\PluginInterface;
use Illuminate\Contracts\Config\Repository;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\Foundation\CachesConfiguration;
use Illuminate\Support\ServiceProvider;
@@ -35,6 +36,14 @@ abstract class PluginServiceProvider extends ServiceProvider
return rtrim($this->getResourcesDir(), '/').'/config.php';
}
protected function getConfig(string $key = null, mixed $default = null): mixed
{
/** @var Repository $config */
$config = $this->app->make('config');
return $key ? $config->get('flasher.'.$key, $default) : $config;
}
protected function getResourcesDir(): string
{
$r = new \ReflectionClass($this);