Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

Commit b503274

Browse files
authored
Merge pull request #15 from speccode/master
Lucid config file
2 parents 3a98824 + bc1e7c2 commit b503274

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

config/lucid.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
return [
4+
/*
5+
|--------------------------------------------------------------------------
6+
| Dashboard
7+
|--------------------------------------------------------------------------
8+
|
9+
| By default /lucid/dashboard is available when env('APP_DEBUG') is true.
10+
| If you set this value to "true" it will be always accessible even on
11+
| production environment.
12+
|
13+
*/
14+
'dashboard' => null,
15+
];

src/LucidServiceProvider.php

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,19 @@ class LucidServiceProvider extends ServiceProvider
2424
*/
2525
public function boot()
2626
{
27-
if (!$this->app->routesAreCached()) {
28-
require_once __DIR__.'/Http/routes.php';
27+
$configPath = __DIR__ . '/../config/lucid.php';
28+
$this->publishes([$configPath => $this->getConfigPath()], 'config');
29+
30+
$dashboardEnabled = $this->app['config']->get('lucid.dashboard');
31+
32+
if ($dashboardEnabled === null) {
33+
$dashboardEnabled = $this->app['config']->get('app.debug');
34+
}
35+
36+
if ($dashboardEnabled === true) {
37+
if (!$this->app->routesAreCached() ) {
38+
require_once __DIR__.'/Http/routes.php';
39+
}
2940
}
3041

3142
$this->loadViewsFrom(__DIR__.'/../resources/views', 'lucid');
@@ -40,6 +51,19 @@ public function boot()
4051
*/
4152
public function register()
4253
{
54+
$configPath = __DIR__ . '/../config/lucid.php';
55+
$this->mergeConfigFrom($configPath, 'lucid');
56+
4357
$this->app->register(LogReaderServiceProvider::class);
4458
}
59+
60+
/**
61+
* Return path to config file.
62+
*
63+
* @return string
64+
*/
65+
private function getConfigPath()
66+
{
67+
return config_path('lucid.php');
68+
}
4569
}

0 commit comments

Comments
 (0)