Viewing file: RouteServiceProvider.php (1.58 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
declare(strict_types=1);
namespace Arcanedev\LogViewer\Providers;
use Arcanedev\LogViewer\Http\Routes\LogViewerRoute; use Arcanedev\Support\Providers\RouteServiceProvider as ServiceProvider;
/** * Class RouteServiceProvider * * @author ARCANEDEV <arcanedev.maroc@gmail.com> */ class RouteServiceProvider extends ServiceProvider { /* ----------------------------------------------------------------- | Getters & Setters | ----------------------------------------------------------------- */
/** * Check if routes is enabled * * @return bool */ public function isEnabled(): bool { return (bool) $this->config('enabled', false); }
/* ----------------------------------------------------------------- | Main Methods | ----------------------------------------------------------------- */
/** * Boot the service provider. */ public function boot(): void { if ($this->isEnabled()) { $this->routes(function () { static::mapRouteClasses([LogViewerRoute::class]); }); } }
/* ----------------------------------------------------------------- | Other Methods | ----------------------------------------------------------------- */
/** * Get config value by key * * @param string $key * @param mixed|null $default * * @return mixed */ private function config($key, $default = null) { return $this->app['config']->get("log-viewer.route.$key", $default); } }
|