Completed
Push — master ( 5ba622...a793ea )
by David
14:14
created

ModuleServiceProvider::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace App\Providers;
4
5
use Illuminate\Filesystem\Filesystem;
6
use Illuminate\Support\ServiceProvider;
7
8
class ModuleServiceProvider extends ServiceProvider
9
{
10
    protected $files;
11
12
    /**
13
     * Bootstrap the application services.
14
     *
15
     * @return void
16
     */
17
    public function boot()
18
    {
19
        $modules = $this->files->directories(app_path() . '/LaravelRestCms/Modules');
20
21
        foreach ($modules as $module)  {
22
            
23
            $route = $module . '/routes.php';
24
25
            if ($this->files->exists($route)) {
26
                require $route;
27
            }
28
        }
29
    }
30
31
    /**
32
     * Register the application services.
33
     *
34
     * @return void
35
     */
36
    public function register()
37
    {
38
        $this->files = new Filesystem;
39
    }
40
}
41