@@ -6,30 +6,30 @@ |
||
6 | 6 | |
7 | 7 | class ModuleServiceProvider extends ServiceProvider |
8 | 8 | { |
9 | - /** |
|
10 | - * Bootstrap the module services. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function boot() |
|
15 | - { |
|
16 | - $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'oauth-clients'); |
|
17 | - $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'oauth-clients'); |
|
9 | + /** |
|
10 | + * Bootstrap the module services. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function boot() |
|
15 | + { |
|
16 | + $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'oauth-clients'); |
|
17 | + $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'oauth-clients'); |
|
18 | 18 | |
19 | - $this->loadMigrationsFrom(module_path('oauth-clients', 'Database/Migrations', 'app')); |
|
20 | - $this->loadFactoriesFrom(module_path('oauth-clients', 'Database/Factories', 'app')); |
|
21 | - if (!$this->app->configurationIsCached()) { |
|
22 | - $this->loadConfigsFrom(module_path('oauth-clients', 'Config', 'app')); |
|
23 | - } |
|
24 | - } |
|
19 | + $this->loadMigrationsFrom(module_path('oauth-clients', 'Database/Migrations', 'app')); |
|
20 | + $this->loadFactoriesFrom(module_path('oauth-clients', 'Database/Factories', 'app')); |
|
21 | + if (!$this->app->configurationIsCached()) { |
|
22 | + $this->loadConfigsFrom(module_path('oauth-clients', 'Config', 'app')); |
|
23 | + } |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * Register the module services. |
|
28 | - * |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public function register() |
|
32 | - { |
|
33 | - $this->app->register(RouteServiceProvider::class); |
|
34 | - } |
|
26 | + /** |
|
27 | + * Register the module services. |
|
28 | + * |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function register() |
|
32 | + { |
|
33 | + $this->app->register(RouteServiceProvider::class); |
|
34 | + } |
|
35 | 35 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | $this->loadMigrationsFrom(module_path('oauth-clients', 'Database/Migrations', 'app')); |
20 | 20 | $this->loadFactoriesFrom(module_path('oauth-clients', 'Database/Factories', 'app')); |
21 | - if (!$this->app->configurationIsCached()) { |
|
21 | + if ( ! $this->app->configurationIsCached()) { |
|
22 | 22 | $this->loadConfigsFrom(module_path('oauth-clients', 'Config', 'app')); |
23 | 23 | } |
24 | 24 | } |
@@ -6,30 +6,30 @@ |
||
6 | 6 | |
7 | 7 | class ModuleServiceProvider extends ServiceProvider |
8 | 8 | { |
9 | - /** |
|
10 | - * Bootstrap the module services. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function boot() |
|
15 | - { |
|
16 | - $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'push-notification-devices'); |
|
17 | - $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'push-notification-devices'); |
|
9 | + /** |
|
10 | + * Bootstrap the module services. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function boot() |
|
15 | + { |
|
16 | + $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'push-notification-devices'); |
|
17 | + $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'push-notification-devices'); |
|
18 | 18 | |
19 | - $this->loadMigrationsFrom(module_path('push-notification-devices', 'Database/Migrations', 'app')); |
|
20 | - $this->loadFactoriesFrom(module_path('push-notification-devices', 'Database/Factories', 'app')); |
|
21 | - if (!$this->app->configurationIsCached()) { |
|
22 | - $this->loadConfigsFrom(module_path('push-notification-devices', 'Config', 'app')); |
|
23 | - } |
|
24 | - } |
|
19 | + $this->loadMigrationsFrom(module_path('push-notification-devices', 'Database/Migrations', 'app')); |
|
20 | + $this->loadFactoriesFrom(module_path('push-notification-devices', 'Database/Factories', 'app')); |
|
21 | + if (!$this->app->configurationIsCached()) { |
|
22 | + $this->loadConfigsFrom(module_path('push-notification-devices', 'Config', 'app')); |
|
23 | + } |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * Register the module services. |
|
28 | - * |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public function register() |
|
32 | - { |
|
33 | - $this->app->register(RouteServiceProvider::class); |
|
34 | - } |
|
26 | + /** |
|
27 | + * Register the module services. |
|
28 | + * |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function register() |
|
32 | + { |
|
33 | + $this->app->register(RouteServiceProvider::class); |
|
34 | + } |
|
35 | 35 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | $this->loadMigrationsFrom(module_path('push-notification-devices', 'Database/Migrations', 'app')); |
20 | 20 | $this->loadFactoriesFrom(module_path('push-notification-devices', 'Database/Factories', 'app')); |
21 | - if (!$this->app->configurationIsCached()) { |
|
21 | + if ( ! $this->app->configurationIsCached()) { |
|
22 | 22 | $this->loadConfigsFrom(module_path('push-notification-devices', 'Config', 'app')); |
23 | 23 | } |
24 | 24 | } |
@@ -6,30 +6,30 @@ |
||
6 | 6 | |
7 | 7 | class ModuleServiceProvider extends ServiceProvider |
8 | 8 | { |
9 | - /** |
|
10 | - * Bootstrap the module services. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function boot() |
|
15 | - { |
|
16 | - $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'roles'); |
|
17 | - $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'roles'); |
|
9 | + /** |
|
10 | + * Bootstrap the module services. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function boot() |
|
15 | + { |
|
16 | + $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'roles'); |
|
17 | + $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'roles'); |
|
18 | 18 | |
19 | - $this->loadMigrationsFrom(module_path('roles', 'Database/Migrations', 'app')); |
|
20 | - $this->loadFactoriesFrom(module_path('roles', 'Database/Factories', 'app')); |
|
21 | - if (!$this->app->configurationIsCached()) { |
|
22 | - $this->loadConfigsFrom(module_path('roles', 'Config', 'app')); |
|
23 | - } |
|
24 | - } |
|
19 | + $this->loadMigrationsFrom(module_path('roles', 'Database/Migrations', 'app')); |
|
20 | + $this->loadFactoriesFrom(module_path('roles', 'Database/Factories', 'app')); |
|
21 | + if (!$this->app->configurationIsCached()) { |
|
22 | + $this->loadConfigsFrom(module_path('roles', 'Config', 'app')); |
|
23 | + } |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * Register the module services. |
|
28 | - * |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public function register() |
|
32 | - { |
|
33 | - $this->app->register(RouteServiceProvider::class); |
|
34 | - } |
|
26 | + /** |
|
27 | + * Register the module services. |
|
28 | + * |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function register() |
|
32 | + { |
|
33 | + $this->app->register(RouteServiceProvider::class); |
|
34 | + } |
|
35 | 35 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | $this->loadMigrationsFrom(module_path('roles', 'Database/Migrations', 'app')); |
20 | 20 | $this->loadFactoriesFrom(module_path('roles', 'Database/Factories', 'app')); |
21 | - if (!$this->app->configurationIsCached()) { |
|
21 | + if ( ! $this->app->configurationIsCached()) { |
|
22 | 22 | $this->loadConfigsFrom(module_path('roles', 'Config', 'app')); |
23 | 23 | } |
24 | 24 | } |
@@ -6,30 +6,30 @@ |
||
6 | 6 | |
7 | 7 | class ModuleServiceProvider extends ServiceProvider |
8 | 8 | { |
9 | - /** |
|
10 | - * Bootstrap the module services. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function boot() |
|
15 | - { |
|
16 | - $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'reporting'); |
|
17 | - $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'reporting'); |
|
9 | + /** |
|
10 | + * Bootstrap the module services. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function boot() |
|
15 | + { |
|
16 | + $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'reporting'); |
|
17 | + $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'reporting'); |
|
18 | 18 | |
19 | - $this->loadMigrationsFrom(module_path('reporting', 'Database/Migrations', 'app')); |
|
20 | - $this->loadFactoriesFrom(module_path('reporting', 'Database/Factories', 'app')); |
|
21 | - if (!$this->app->configurationIsCached()) { |
|
22 | - $this->loadConfigsFrom(module_path('reporting', 'Config', 'app')); |
|
23 | - } |
|
24 | - } |
|
19 | + $this->loadMigrationsFrom(module_path('reporting', 'Database/Migrations', 'app')); |
|
20 | + $this->loadFactoriesFrom(module_path('reporting', 'Database/Factories', 'app')); |
|
21 | + if (!$this->app->configurationIsCached()) { |
|
22 | + $this->loadConfigsFrom(module_path('reporting', 'Config', 'app')); |
|
23 | + } |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * Register the module services. |
|
28 | - * |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public function register() |
|
32 | - { |
|
33 | - $this->app->register(RouteServiceProvider::class); |
|
34 | - } |
|
26 | + /** |
|
27 | + * Register the module services. |
|
28 | + * |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function register() |
|
32 | + { |
|
33 | + $this->app->register(RouteServiceProvider::class); |
|
34 | + } |
|
35 | 35 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | $this->loadMigrationsFrom(module_path('reporting', 'Database/Migrations', 'app')); |
20 | 20 | $this->loadFactoriesFrom(module_path('reporting', 'Database/Factories', 'app')); |
21 | - if (!$this->app->configurationIsCached()) { |
|
21 | + if ( ! $this->app->configurationIsCached()) { |
|
22 | 22 | $this->loadConfigsFrom(module_path('reporting', 'Config', 'app')); |
23 | 23 | } |
24 | 24 | } |
@@ -6,30 +6,30 @@ |
||
6 | 6 | |
7 | 7 | class ModuleServiceProvider extends ServiceProvider |
8 | 8 | { |
9 | - /** |
|
10 | - * Bootstrap the module services. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function boot() |
|
15 | - { |
|
16 | - $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'notifications'); |
|
17 | - $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'notifications'); |
|
9 | + /** |
|
10 | + * Bootstrap the module services. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function boot() |
|
15 | + { |
|
16 | + $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'notifications'); |
|
17 | + $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'notifications'); |
|
18 | 18 | |
19 | - $this->loadMigrationsFrom(module_path('notifications', 'Database/Migrations', 'app')); |
|
20 | - $this->loadFactoriesFrom(module_path('notifications', 'Database/Factories', 'app')); |
|
21 | - if (!$this->app->configurationIsCached()) { |
|
22 | - $this->loadConfigsFrom(module_path('notifications', 'Config', 'app')); |
|
23 | - } |
|
24 | - } |
|
19 | + $this->loadMigrationsFrom(module_path('notifications', 'Database/Migrations', 'app')); |
|
20 | + $this->loadFactoriesFrom(module_path('notifications', 'Database/Factories', 'app')); |
|
21 | + if (!$this->app->configurationIsCached()) { |
|
22 | + $this->loadConfigsFrom(module_path('notifications', 'Config', 'app')); |
|
23 | + } |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * Register the module services. |
|
28 | - * |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public function register() |
|
32 | - { |
|
33 | - $this->app->register(RouteServiceProvider::class); |
|
34 | - } |
|
26 | + /** |
|
27 | + * Register the module services. |
|
28 | + * |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function register() |
|
32 | + { |
|
33 | + $this->app->register(RouteServiceProvider::class); |
|
34 | + } |
|
35 | 35 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | $this->loadMigrationsFrom(module_path('notifications', 'Database/Migrations', 'app')); |
20 | 20 | $this->loadFactoriesFrom(module_path('notifications', 'Database/Factories', 'app')); |
21 | - if (!$this->app->configurationIsCached()) { |
|
21 | + if ( ! $this->app->configurationIsCached()) { |
|
22 | 22 | $this->loadConfigsFrom(module_path('notifications', 'Config', 'app')); |
23 | 23 | } |
24 | 24 | } |
@@ -6,51 +6,51 @@ |
||
6 | 6 | |
7 | 7 | class ModuleServiceProvider extends ServiceProvider |
8 | 8 | { |
9 | - /** |
|
10 | - * Bootstrap the module services. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function boot() |
|
15 | - { |
|
16 | - $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'core'); |
|
17 | - $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'core'); |
|
18 | - |
|
19 | - $this->loadMigrationsFrom(module_path('core', 'Database/Migrations', 'app')); |
|
20 | - $this->loadFactoriesFrom(module_path('core', 'Database/Factories', 'app')); |
|
21 | - if (!$this->app->configurationIsCached()) { |
|
22 | - $this->loadConfigsFrom(module_path('core', 'Config', 'app')); |
|
23 | - } |
|
24 | - } |
|
25 | - |
|
26 | - /** |
|
27 | - * Register the module services. |
|
28 | - * |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public function register() |
|
32 | - { |
|
33 | - //Bind Core Facade to the Service Container |
|
34 | - $this->app->singleton('Core', function () { |
|
35 | - return new \App\Modules\Core\Core; |
|
36 | - }); |
|
37 | - |
|
38 | - //Bind Errors Facade to the Service Container |
|
39 | - $this->app->singleton('Errors', function () { |
|
40 | - return new \App\Modules\Core\Errors\Errors; |
|
41 | - }); |
|
42 | - |
|
43 | - //Bind Media Facade to the Service Container |
|
44 | - $this->app->singleton('Media', function () { |
|
45 | - return new \App\Modules\Core\Utl\Media; |
|
46 | - }); |
|
47 | - |
|
48 | - //Bind ApiConsumer Facade to the Service Container |
|
49 | - $this->app->singleton('ApiConsumer', function () { |
|
50 | - $app = app(); |
|
51 | - return new \App\Modules\Core\Utl\ApiConsumer($app, $app['request'], $app['router']); |
|
52 | - }); |
|
9 | + /** |
|
10 | + * Bootstrap the module services. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function boot() |
|
15 | + { |
|
16 | + $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'core'); |
|
17 | + $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'core'); |
|
18 | + |
|
19 | + $this->loadMigrationsFrom(module_path('core', 'Database/Migrations', 'app')); |
|
20 | + $this->loadFactoriesFrom(module_path('core', 'Database/Factories', 'app')); |
|
21 | + if (!$this->app->configurationIsCached()) { |
|
22 | + $this->loadConfigsFrom(module_path('core', 'Config', 'app')); |
|
23 | + } |
|
24 | + } |
|
25 | + |
|
26 | + /** |
|
27 | + * Register the module services. |
|
28 | + * |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function register() |
|
32 | + { |
|
33 | + //Bind Core Facade to the Service Container |
|
34 | + $this->app->singleton('Core', function () { |
|
35 | + return new \App\Modules\Core\Core; |
|
36 | + }); |
|
37 | + |
|
38 | + //Bind Errors Facade to the Service Container |
|
39 | + $this->app->singleton('Errors', function () { |
|
40 | + return new \App\Modules\Core\Errors\Errors; |
|
41 | + }); |
|
42 | + |
|
43 | + //Bind Media Facade to the Service Container |
|
44 | + $this->app->singleton('Media', function () { |
|
45 | + return new \App\Modules\Core\Utl\Media; |
|
46 | + }); |
|
47 | + |
|
48 | + //Bind ApiConsumer Facade to the Service Container |
|
49 | + $this->app->singleton('ApiConsumer', function () { |
|
50 | + $app = app(); |
|
51 | + return new \App\Modules\Core\Utl\ApiConsumer($app, $app['request'], $app['router']); |
|
52 | + }); |
|
53 | 53 | |
54 | - $this->app->register(RouteServiceProvider::class); |
|
55 | - } |
|
54 | + $this->app->register(RouteServiceProvider::class); |
|
55 | + } |
|
56 | 56 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | $this->loadMigrationsFrom(module_path('core', 'Database/Migrations', 'app')); |
20 | 20 | $this->loadFactoriesFrom(module_path('core', 'Database/Factories', 'app')); |
21 | - if (!$this->app->configurationIsCached()) { |
|
21 | + if ( ! $this->app->configurationIsCached()) { |
|
22 | 22 | $this->loadConfigsFrom(module_path('core', 'Config', 'app')); |
23 | 23 | } |
24 | 24 | } |
@@ -31,22 +31,22 @@ discard block |
||
31 | 31 | public function register() |
32 | 32 | { |
33 | 33 | //Bind Core Facade to the Service Container |
34 | - $this->app->singleton('Core', function () { |
|
34 | + $this->app->singleton('Core', function() { |
|
35 | 35 | return new \App\Modules\Core\Core; |
36 | 36 | }); |
37 | 37 | |
38 | 38 | //Bind Errors Facade to the Service Container |
39 | - $this->app->singleton('Errors', function () { |
|
39 | + $this->app->singleton('Errors', function() { |
|
40 | 40 | return new \App\Modules\Core\Errors\Errors; |
41 | 41 | }); |
42 | 42 | |
43 | 43 | //Bind Media Facade to the Service Container |
44 | - $this->app->singleton('Media', function () { |
|
44 | + $this->app->singleton('Media', function() { |
|
45 | 45 | return new \App\Modules\Core\Utl\Media; |
46 | 46 | }); |
47 | 47 | |
48 | 48 | //Bind ApiConsumer Facade to the Service Container |
49 | - $this->app->singleton('ApiConsumer', function () { |
|
49 | + $this->app->singleton('ApiConsumer', function() { |
|
50 | 50 | $app = app(); |
51 | 51 | return new \App\Modules\Core\Utl\ApiConsumer($app, $app['request'], $app['router']); |
52 | 52 | }); |
@@ -7,39 +7,39 @@ |
||
7 | 7 | |
8 | 8 | class PassportInstallCommand extends Command |
9 | 9 | { |
10 | - /** |
|
11 | - * The name and signature of the console command. |
|
12 | - * |
|
13 | - * @var string |
|
14 | - */ |
|
15 | - protected $signature = 'module:passport:install |
|
10 | + /** |
|
11 | + * The name and signature of the console command. |
|
12 | + * |
|
13 | + * @var string |
|
14 | + */ |
|
15 | + protected $signature = 'module:passport:install |
|
16 | 16 | {--force : Overwrite keys they already exist} |
17 | 17 | {--length=4096 : The length of the private key}'; |
18 | 18 | |
19 | - /** |
|
20 | - * The console command description. |
|
21 | - * |
|
22 | - * @var string |
|
23 | - */ |
|
24 | - protected $description = 'Run the commands necessary to prepare Passport for use'; |
|
19 | + /** |
|
20 | + * The console command description. |
|
21 | + * |
|
22 | + * @var string |
|
23 | + */ |
|
24 | + protected $description = 'Run the commands necessary to prepare Passport for use'; |
|
25 | 25 | |
26 | - /** |
|
27 | - * Execute the console command. |
|
28 | - * |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public function handle(ClientRepository $client) |
|
32 | - { |
|
33 | - $this->call('passport:keys', ['--force' => $this->option('force'), '--length' => $this->option('length')]); |
|
34 | - if (! \Core::oauthCLients()->first(['password_client' => 1])) { |
|
35 | - $client = $client->createPasswordGrantClient( |
|
36 | - null, |
|
37 | - config('app.name'), |
|
38 | - 'http://localhost' |
|
39 | - ); |
|
40 | - \DotenvEditor::setKey('PASSWORD_CLIENT_ID', $client->id); |
|
41 | - \DotenvEditor::setKey('PASSWORD_CLIENT_SECRET', $client->secret); |
|
42 | - \DotenvEditor::save(); |
|
43 | - } |
|
44 | - } |
|
26 | + /** |
|
27 | + * Execute the console command. |
|
28 | + * |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function handle(ClientRepository $client) |
|
32 | + { |
|
33 | + $this->call('passport:keys', ['--force' => $this->option('force'), '--length' => $this->option('length')]); |
|
34 | + if (! \Core::oauthCLients()->first(['password_client' => 1])) { |
|
35 | + $client = $client->createPasswordGrantClient( |
|
36 | + null, |
|
37 | + config('app.name'), |
|
38 | + 'http://localhost' |
|
39 | + ); |
|
40 | + \DotenvEditor::setKey('PASSWORD_CLIENT_ID', $client->id); |
|
41 | + \DotenvEditor::setKey('PASSWORD_CLIENT_SECRET', $client->secret); |
|
42 | + \DotenvEditor::save(); |
|
43 | + } |
|
44 | + } |
|
45 | 45 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | public function handle(ClientRepository $client) |
32 | 32 | { |
33 | 33 | $this->call('passport:keys', ['--force' => $this->option('force'), '--length' => $this->option('length')]); |
34 | - if (! \Core::oauthCLients()->first(['password_client' => 1])) { |
|
34 | + if ( ! \Core::oauthCLients()->first(['password_client' => 1])) { |
|
35 | 35 | $client = $client->createPasswordGrantClient( |
36 | 36 | null, |
37 | 37 | config('app.name'), |
@@ -6,30 +6,30 @@ |
||
6 | 6 | |
7 | 7 | class ModuleServiceProvider extends ServiceProvider |
8 | 8 | { |
9 | - /** |
|
10 | - * Bootstrap the module services. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function boot() |
|
15 | - { |
|
16 | - $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'DummyModuleSlug'); |
|
17 | - $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'DummyModuleSlug'); |
|
9 | + /** |
|
10 | + * Bootstrap the module services. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function boot() |
|
15 | + { |
|
16 | + $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'DummyModuleSlug'); |
|
17 | + $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'DummyModuleSlug'); |
|
18 | 18 | |
19 | - $this->loadMigrationsFrom(module_path('DummyModuleSlug', 'Database/Migrations', 'app')); |
|
20 | - $this->loadFactoriesFrom(module_path('DummyModuleSlug', 'Database/Factories', 'app')); |
|
21 | - if (!$this->app->configurationIsCached()) { |
|
22 | - $this->loadConfigsFrom(module_path('DummyModuleSlug', 'Config', 'app')); |
|
23 | - } |
|
24 | - } |
|
19 | + $this->loadMigrationsFrom(module_path('DummyModuleSlug', 'Database/Migrations', 'app')); |
|
20 | + $this->loadFactoriesFrom(module_path('DummyModuleSlug', 'Database/Factories', 'app')); |
|
21 | + if (!$this->app->configurationIsCached()) { |
|
22 | + $this->loadConfigsFrom(module_path('DummyModuleSlug', 'Config', 'app')); |
|
23 | + } |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * Register the module services. |
|
28 | - * |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public function register() |
|
32 | - { |
|
33 | - $this->app->register(RouteServiceProvider::class); |
|
34 | - } |
|
26 | + /** |
|
27 | + * Register the module services. |
|
28 | + * |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function register() |
|
32 | + { |
|
33 | + $this->app->register(RouteServiceProvider::class); |
|
34 | + } |
|
35 | 35 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | $this->loadMigrationsFrom(module_path('DummyModuleSlug', 'Database/Migrations', 'app')); |
20 | 20 | $this->loadFactoriesFrom(module_path('DummyModuleSlug', 'Database/Factories', 'app')); |
21 | - if (!$this->app->configurationIsCached()) { |
|
21 | + if ( ! $this->app->configurationIsCached()) { |
|
22 | 22 | $this->loadConfigsFrom(module_path('DummyModuleSlug', 'Config', 'app')); |
23 | 23 | } |
24 | 24 | } |
@@ -8,279 +8,279 @@ |
||
8 | 8 | |
9 | 9 | class GenerateDocCommand extends Command |
10 | 10 | { |
11 | - /** |
|
12 | - * The name and signature of the console command. |
|
13 | - * |
|
14 | - * @var string |
|
15 | - */ |
|
16 | - protected $signature = 'doc:generate'; |
|
11 | + /** |
|
12 | + * The name and signature of the console command. |
|
13 | + * |
|
14 | + * @var string |
|
15 | + */ |
|
16 | + protected $signature = 'doc:generate'; |
|
17 | 17 | |
18 | - /** |
|
19 | - * The console command description. |
|
20 | - * |
|
21 | - * @var string |
|
22 | - */ |
|
23 | - protected $description = 'Generate api documentation'; |
|
18 | + /** |
|
19 | + * The console command description. |
|
20 | + * |
|
21 | + * @var string |
|
22 | + */ |
|
23 | + protected $description = 'Generate api documentation'; |
|
24 | 24 | |
25 | - /** |
|
26 | - * @var ReprotService |
|
27 | - */ |
|
28 | - protected $reportService; |
|
25 | + /** |
|
26 | + * @var ReprotService |
|
27 | + */ |
|
28 | + protected $reportService; |
|
29 | 29 | |
30 | - /** |
|
31 | - * Init new object. |
|
32 | - * |
|
33 | - * @return void |
|
34 | - */ |
|
35 | - public function __construct(ReportService $reportService) |
|
36 | - { |
|
37 | - $this->reportService = $reportService; |
|
38 | - parent::__construct(); |
|
39 | - } |
|
30 | + /** |
|
31 | + * Init new object. |
|
32 | + * |
|
33 | + * @return void |
|
34 | + */ |
|
35 | + public function __construct(ReportService $reportService) |
|
36 | + { |
|
37 | + $this->reportService = $reportService; |
|
38 | + parent::__construct(); |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * Execute the console command. |
|
43 | - * |
|
44 | - * @return mixed |
|
45 | - */ |
|
46 | - public function handle() |
|
47 | - { |
|
48 | - $docData = []; |
|
49 | - $docData['models'] = []; |
|
50 | - $routes = $this->getRoutes(); |
|
51 | - foreach ($routes as $route) { |
|
52 | - if ($route) { |
|
53 | - $actoinArray = explode('@', $route['action']); |
|
54 | - if (Arr::get($actoinArray, 1, false)) { |
|
55 | - $prefix = $route['prefix']; |
|
56 | - $module = \Str::camel(str_replace('/', '_', str_replace('api', '', $prefix))); |
|
57 | - if ($prefix === 'telescope') { |
|
58 | - continue; |
|
59 | - } |
|
41 | + /** |
|
42 | + * Execute the console command. |
|
43 | + * |
|
44 | + * @return mixed |
|
45 | + */ |
|
46 | + public function handle() |
|
47 | + { |
|
48 | + $docData = []; |
|
49 | + $docData['models'] = []; |
|
50 | + $routes = $this->getRoutes(); |
|
51 | + foreach ($routes as $route) { |
|
52 | + if ($route) { |
|
53 | + $actoinArray = explode('@', $route['action']); |
|
54 | + if (Arr::get($actoinArray, 1, false)) { |
|
55 | + $prefix = $route['prefix']; |
|
56 | + $module = \Str::camel(str_replace('/', '_', str_replace('api', '', $prefix))); |
|
57 | + if ($prefix === 'telescope') { |
|
58 | + continue; |
|
59 | + } |
|
60 | 60 | |
61 | - $controller = $actoinArray[0]; |
|
62 | - $method = $actoinArray[1]; |
|
63 | - $route['name'] = $method !== 'index' ? $method : 'list'; |
|
61 | + $controller = $actoinArray[0]; |
|
62 | + $method = $actoinArray[1]; |
|
63 | + $route['name'] = $method !== 'index' ? $method : 'list'; |
|
64 | 64 | |
65 | - $reflectionClass = new \ReflectionClass($controller); |
|
66 | - $reflectionMethod = $reflectionClass->getMethod($method); |
|
67 | - $classProperties = $reflectionClass->getDefaultProperties(); |
|
68 | - $skipLoginCheck = Arr::get($classProperties, 'skipLoginCheck', false); |
|
69 | - $modelName = explode('\\', $controller); |
|
70 | - $modelName = lcfirst(str_replace('Controller', '', end($modelName))); |
|
65 | + $reflectionClass = new \ReflectionClass($controller); |
|
66 | + $reflectionMethod = $reflectionClass->getMethod($method); |
|
67 | + $classProperties = $reflectionClass->getDefaultProperties(); |
|
68 | + $skipLoginCheck = Arr::get($classProperties, 'skipLoginCheck', false); |
|
69 | + $modelName = explode('\\', $controller); |
|
70 | + $modelName = lcfirst(str_replace('Controller', '', end($modelName))); |
|
71 | 71 | |
72 | - $this->processDocBlock($route, $reflectionMethod); |
|
73 | - $this->getHeaders($route, $method, $skipLoginCheck); |
|
74 | - $this->getPostData($route, $reflectionMethod); |
|
72 | + $this->processDocBlock($route, $reflectionMethod); |
|
73 | + $this->getHeaders($route, $method, $skipLoginCheck); |
|
74 | + $this->getPostData($route, $reflectionMethod); |
|
75 | 75 | |
76 | - $route['response'] = $this->getResponseObject($modelName, $route['name'], $route['returnDocBlock']); |
|
77 | - $docData['modules'][$module][] = $route; |
|
76 | + $route['response'] = $this->getResponseObject($modelName, $route['name'], $route['returnDocBlock']); |
|
77 | + $docData['modules'][$module][] = $route; |
|
78 | 78 | |
79 | - $this->getModels($modelName, $docData, $reflectionClass); |
|
80 | - } |
|
81 | - } |
|
82 | - } |
|
79 | + $this->getModels($modelName, $docData, $reflectionClass); |
|
80 | + } |
|
81 | + } |
|
82 | + } |
|
83 | 83 | |
84 | - $docData['errors'] = $this->getErrors(); |
|
85 | - $docData['reports'] = $this->reportService->all(); |
|
86 | - \File::put(app_path('Modules/Core/Resources/api.json'), json_encode($docData)); |
|
87 | - } |
|
84 | + $docData['errors'] = $this->getErrors(); |
|
85 | + $docData['reports'] = $this->reportService->all(); |
|
86 | + \File::put(app_path('Modules/Core/Resources/api.json'), json_encode($docData)); |
|
87 | + } |
|
88 | 88 | |
89 | - /** |
|
90 | - * Get list of all registered routes. |
|
91 | - * |
|
92 | - * @return collection |
|
93 | - */ |
|
94 | - protected function getRoutes() |
|
95 | - { |
|
96 | - return collect(\Route::getRoutes())->map(function ($route) { |
|
97 | - if (strpos($route->uri(), 'api/') !== false) { |
|
98 | - return [ |
|
99 | - 'method' => $route->methods()[0], |
|
100 | - 'uri' => $route->uri(), |
|
101 | - 'action' => $route->getActionName(), |
|
102 | - 'prefix' => $route->getPrefix() |
|
103 | - ]; |
|
104 | - } |
|
105 | - return false; |
|
106 | - })->all(); |
|
107 | - } |
|
89 | + /** |
|
90 | + * Get list of all registered routes. |
|
91 | + * |
|
92 | + * @return collection |
|
93 | + */ |
|
94 | + protected function getRoutes() |
|
95 | + { |
|
96 | + return collect(\Route::getRoutes())->map(function ($route) { |
|
97 | + if (strpos($route->uri(), 'api/') !== false) { |
|
98 | + return [ |
|
99 | + 'method' => $route->methods()[0], |
|
100 | + 'uri' => $route->uri(), |
|
101 | + 'action' => $route->getActionName(), |
|
102 | + 'prefix' => $route->getPrefix() |
|
103 | + ]; |
|
104 | + } |
|
105 | + return false; |
|
106 | + })->all(); |
|
107 | + } |
|
108 | 108 | |
109 | - /** |
|
110 | - * Generate headers for the given route. |
|
111 | - * |
|
112 | - * @param array &$route |
|
113 | - * @param string $method |
|
114 | - * @param array $skipLoginCheck |
|
115 | - * @return void |
|
116 | - */ |
|
117 | - protected function getHeaders(&$route, $method, $skipLoginCheck) |
|
118 | - { |
|
119 | - $route['headers'] = [ |
|
120 | - 'Accept' => 'application/json', |
|
121 | - 'Content-Type' => 'application/json', |
|
122 | - 'locale' => 'The language of the returned data: ar, en or all.', |
|
123 | - 'time-zone' => 'Your locale time zone', |
|
124 | - ]; |
|
109 | + /** |
|
110 | + * Generate headers for the given route. |
|
111 | + * |
|
112 | + * @param array &$route |
|
113 | + * @param string $method |
|
114 | + * @param array $skipLoginCheck |
|
115 | + * @return void |
|
116 | + */ |
|
117 | + protected function getHeaders(&$route, $method, $skipLoginCheck) |
|
118 | + { |
|
119 | + $route['headers'] = [ |
|
120 | + 'Accept' => 'application/json', |
|
121 | + 'Content-Type' => 'application/json', |
|
122 | + 'locale' => 'The language of the returned data: ar, en or all.', |
|
123 | + 'time-zone' => 'Your locale time zone', |
|
124 | + ]; |
|
125 | 125 | |
126 | 126 | |
127 | - if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) { |
|
128 | - $route['headers']['Authorization'] = 'Bearer {token}'; |
|
129 | - } |
|
130 | - } |
|
127 | + if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) { |
|
128 | + $route['headers']['Authorization'] = 'Bearer {token}'; |
|
129 | + } |
|
130 | + } |
|
131 | 131 | |
132 | - /** |
|
133 | - * Generate description and params for the given route |
|
134 | - * based on the docblock. |
|
135 | - * |
|
136 | - * @param array &$route |
|
137 | - * @param \ReflectionMethod $reflectionMethod |
|
138 | - * @return void |
|
139 | - */ |
|
140 | - protected function processDocBlock(&$route, $reflectionMethod) |
|
141 | - { |
|
142 | - $factory = \phpDocumentor\Reflection\DocBlockFactory::createInstance(); |
|
143 | - $docblock = $factory->create($reflectionMethod->getDocComment()); |
|
144 | - $route['description'] = trim(preg_replace('/\s+/', ' ', $docblock->getSummary())); |
|
145 | - $params = $docblock->getTagsByName('param'); |
|
146 | - $route['returnDocBlock'] = $docblock->getTagsByName('return')[0]->getType()->getFqsen()->getName(); |
|
132 | + /** |
|
133 | + * Generate description and params for the given route |
|
134 | + * based on the docblock. |
|
135 | + * |
|
136 | + * @param array &$route |
|
137 | + * @param \ReflectionMethod $reflectionMethod |
|
138 | + * @return void |
|
139 | + */ |
|
140 | + protected function processDocBlock(&$route, $reflectionMethod) |
|
141 | + { |
|
142 | + $factory = \phpDocumentor\Reflection\DocBlockFactory::createInstance(); |
|
143 | + $docblock = $factory->create($reflectionMethod->getDocComment()); |
|
144 | + $route['description'] = trim(preg_replace('/\s+/', ' ', $docblock->getSummary())); |
|
145 | + $params = $docblock->getTagsByName('param'); |
|
146 | + $route['returnDocBlock'] = $docblock->getTagsByName('return')[0]->getType()->getFqsen()->getName(); |
|
147 | 147 | |
148 | - foreach ($params as $param) { |
|
149 | - $name = $param->getVariableName(); |
|
150 | - if ($name !== 'request') { |
|
151 | - $route['parametars'][$param->getVariableName()] = $param->getDescription()->render(); |
|
152 | - } |
|
153 | - } |
|
148 | + foreach ($params as $param) { |
|
149 | + $name = $param->getVariableName(); |
|
150 | + if ($name !== 'request') { |
|
151 | + $route['parametars'][$param->getVariableName()] = $param->getDescription()->render(); |
|
152 | + } |
|
153 | + } |
|
154 | 154 | |
155 | - if ($route['name'] === 'list') { |
|
156 | - $route['parametars']['perPage'] = 'perPage?'; |
|
157 | - $route['parametars']['sortBy'] = 'sortBy?'; |
|
158 | - $route['parametars']['desc'] = 'desc?'; |
|
159 | - $route['parametars']['trashed'] = 'trashed?'; |
|
160 | - } |
|
161 | - } |
|
155 | + if ($route['name'] === 'list') { |
|
156 | + $route['parametars']['perPage'] = 'perPage?'; |
|
157 | + $route['parametars']['sortBy'] = 'sortBy?'; |
|
158 | + $route['parametars']['desc'] = 'desc?'; |
|
159 | + $route['parametars']['trashed'] = 'trashed?'; |
|
160 | + } |
|
161 | + } |
|
162 | 162 | |
163 | - /** |
|
164 | - * Generate post body for the given route. |
|
165 | - * |
|
166 | - * @param array &$route |
|
167 | - * @param \ReflectionMethod $reflectionMethod |
|
168 | - * @return void |
|
169 | - */ |
|
170 | - protected function getPostData(&$route, $reflectionMethod) |
|
171 | - { |
|
172 | - $parameters = $reflectionMethod->getParameters(); |
|
173 | - if (count($parameters)) { |
|
174 | - $className = optional($reflectionMethod->getParameters()[0]->getType())->getName(); |
|
175 | - if ($className) { |
|
176 | - $reflectionClass = new \ReflectionClass($className); |
|
163 | + /** |
|
164 | + * Generate post body for the given route. |
|
165 | + * |
|
166 | + * @param array &$route |
|
167 | + * @param \ReflectionMethod $reflectionMethod |
|
168 | + * @return void |
|
169 | + */ |
|
170 | + protected function getPostData(&$route, $reflectionMethod) |
|
171 | + { |
|
172 | + $parameters = $reflectionMethod->getParameters(); |
|
173 | + if (count($parameters)) { |
|
174 | + $className = optional($reflectionMethod->getParameters()[0]->getType())->getName(); |
|
175 | + if ($className) { |
|
176 | + $reflectionClass = new \ReflectionClass($className); |
|
177 | 177 | |
178 | - if ($reflectionClass->hasMethod('rules')) { |
|
179 | - $reflectionMethod = $reflectionClass->getMethod('rules'); |
|
180 | - $route['body'] = $reflectionMethod->invoke(new $className); |
|
178 | + if ($reflectionClass->hasMethod('rules')) { |
|
179 | + $reflectionMethod = $reflectionClass->getMethod('rules'); |
|
180 | + $route['body'] = $reflectionMethod->invoke(new $className); |
|
181 | 181 | |
182 | - foreach ($route['body'] as &$rule) { |
|
183 | - if (strpos($rule, 'unique')) { |
|
184 | - $rule = substr($rule, 0, strpos($rule, 'unique') + 6); |
|
185 | - } elseif (strpos($rule, 'exists')) { |
|
186 | - $rule = substr($rule, 0, strpos($rule, 'exists') - 1); |
|
187 | - } |
|
188 | - } |
|
189 | - } |
|
190 | - } |
|
191 | - } |
|
192 | - } |
|
182 | + foreach ($route['body'] as &$rule) { |
|
183 | + if (strpos($rule, 'unique')) { |
|
184 | + $rule = substr($rule, 0, strpos($rule, 'unique') + 6); |
|
185 | + } elseif (strpos($rule, 'exists')) { |
|
186 | + $rule = substr($rule, 0, strpos($rule, 'exists') - 1); |
|
187 | + } |
|
188 | + } |
|
189 | + } |
|
190 | + } |
|
191 | + } |
|
192 | + } |
|
193 | 193 | |
194 | - /** |
|
195 | - * Generate application errors. |
|
196 | - * |
|
197 | - * @return array |
|
198 | - */ |
|
199 | - protected function getErrors() |
|
200 | - { |
|
201 | - $errors = []; |
|
202 | - foreach (\Module::all() as $module) { |
|
203 | - $nameSpace = 'App\\Modules\\' . $module['basename'] ; |
|
204 | - $class = $nameSpace . '\\Errors\\' . $module['basename'] . 'Errors'; |
|
205 | - $reflectionClass = new \ReflectionClass($class); |
|
206 | - foreach ($reflectionClass->getMethods() as $method) { |
|
207 | - $methodName = $method->name; |
|
208 | - $reflectionMethod = $reflectionClass->getMethod($methodName); |
|
209 | - $body = $this->getMethodBody($reflectionMethod); |
|
194 | + /** |
|
195 | + * Generate application errors. |
|
196 | + * |
|
197 | + * @return array |
|
198 | + */ |
|
199 | + protected function getErrors() |
|
200 | + { |
|
201 | + $errors = []; |
|
202 | + foreach (\Module::all() as $module) { |
|
203 | + $nameSpace = 'App\\Modules\\' . $module['basename'] ; |
|
204 | + $class = $nameSpace . '\\Errors\\' . $module['basename'] . 'Errors'; |
|
205 | + $reflectionClass = new \ReflectionClass($class); |
|
206 | + foreach ($reflectionClass->getMethods() as $method) { |
|
207 | + $methodName = $method->name; |
|
208 | + $reflectionMethod = $reflectionClass->getMethod($methodName); |
|
209 | + $body = $this->getMethodBody($reflectionMethod); |
|
210 | 210 | |
211 | - preg_match('/\$error=\[\'status\'=>([^#]+)\,/iU', $body, $match); |
|
211 | + preg_match('/\$error=\[\'status\'=>([^#]+)\,/iU', $body, $match); |
|
212 | 212 | |
213 | - if (count($match)) { |
|
214 | - $errors[$match[1]][] = $methodName; |
|
215 | - } |
|
216 | - } |
|
217 | - } |
|
213 | + if (count($match)) { |
|
214 | + $errors[$match[1]][] = $methodName; |
|
215 | + } |
|
216 | + } |
|
217 | + } |
|
218 | 218 | |
219 | - return $errors; |
|
220 | - } |
|
219 | + return $errors; |
|
220 | + } |
|
221 | 221 | |
222 | - /** |
|
223 | - * Get the given method body code. |
|
224 | - * |
|
225 | - * @param object $reflectionMethod |
|
226 | - * @return string |
|
227 | - */ |
|
228 | - protected function getMethodBody($reflectionMethod) |
|
229 | - { |
|
230 | - $filename = $reflectionMethod->getFileName(); |
|
231 | - $start_line = $reflectionMethod->getStartLine() - 1; |
|
232 | - $end_line = $reflectionMethod->getEndLine(); |
|
233 | - $length = $end_line - $start_line; |
|
234 | - $source = file($filename); |
|
235 | - $body = implode("", array_slice($source, $start_line, $length)); |
|
236 | - $body = trim(preg_replace('/\s+/', '', $body)); |
|
222 | + /** |
|
223 | + * Get the given method body code. |
|
224 | + * |
|
225 | + * @param object $reflectionMethod |
|
226 | + * @return string |
|
227 | + */ |
|
228 | + protected function getMethodBody($reflectionMethod) |
|
229 | + { |
|
230 | + $filename = $reflectionMethod->getFileName(); |
|
231 | + $start_line = $reflectionMethod->getStartLine() - 1; |
|
232 | + $end_line = $reflectionMethod->getEndLine(); |
|
233 | + $length = $end_line - $start_line; |
|
234 | + $source = file($filename); |
|
235 | + $body = implode("", array_slice($source, $start_line, $length)); |
|
236 | + $body = trim(preg_replace('/\s+/', '', $body)); |
|
237 | 237 | |
238 | - return $body; |
|
239 | - } |
|
238 | + return $body; |
|
239 | + } |
|
240 | 240 | |
241 | - /** |
|
242 | - * Get example object of all availble models. |
|
243 | - * |
|
244 | - * @param string $modelName |
|
245 | - * @param array $docData |
|
246 | - * @return string |
|
247 | - */ |
|
248 | - protected function getModels($modelName, &$docData, $reflectionClass) |
|
249 | - { |
|
250 | - if ($modelName && ! Arr::has($docData['models'], $modelName)) { |
|
251 | - $modelClass = get_class(call_user_func_array("\Core::{$modelName}", [])->model); |
|
252 | - $model = factory($modelClass)->make(); |
|
241 | + /** |
|
242 | + * Get example object of all availble models. |
|
243 | + * |
|
244 | + * @param string $modelName |
|
245 | + * @param array $docData |
|
246 | + * @return string |
|
247 | + */ |
|
248 | + protected function getModels($modelName, &$docData, $reflectionClass) |
|
249 | + { |
|
250 | + if ($modelName && ! Arr::has($docData['models'], $modelName)) { |
|
251 | + $modelClass = get_class(call_user_func_array("\Core::{$modelName}", [])->model); |
|
252 | + $model = factory($modelClass)->make(); |
|
253 | 253 | |
254 | - $property = $reflectionClass->getProperty('modelResource'); |
|
255 | - $property->setAccessible(true); |
|
256 | - $modelResource = $property->getValue(\App::make($reflectionClass->getName())); |
|
257 | - $modelResource = new $modelResource($model); |
|
258 | - $modelArr = $modelResource->toArray([]); |
|
254 | + $property = $reflectionClass->getProperty('modelResource'); |
|
255 | + $property->setAccessible(true); |
|
256 | + $modelResource = $property->getValue(\App::make($reflectionClass->getName())); |
|
257 | + $modelResource = new $modelResource($model); |
|
258 | + $modelArr = $modelResource->toArray([]); |
|
259 | 259 | |
260 | - foreach ($modelArr as $key => $attr) { |
|
261 | - if (is_object($attr) && property_exists($attr, 'resource') && $attr->resource instanceof \Illuminate\Http\Resources\MissingValue) { |
|
262 | - unset($modelArr[$key]); |
|
263 | - } |
|
264 | - } |
|
260 | + foreach ($modelArr as $key => $attr) { |
|
261 | + if (is_object($attr) && property_exists($attr, 'resource') && $attr->resource instanceof \Illuminate\Http\Resources\MissingValue) { |
|
262 | + unset($modelArr[$key]); |
|
263 | + } |
|
264 | + } |
|
265 | 265 | |
266 | - $docData['models'][$modelName] = json_encode($modelArr, JSON_PRETTY_PRINT); |
|
267 | - } |
|
268 | - } |
|
266 | + $docData['models'][$modelName] = json_encode($modelArr, JSON_PRETTY_PRINT); |
|
267 | + } |
|
268 | + } |
|
269 | 269 | |
270 | - /** |
|
271 | - * Get the route response object type. |
|
272 | - * |
|
273 | - * @param string $modelName |
|
274 | - * @param string $method |
|
275 | - * @param string $returnDocBlock |
|
276 | - * @return array |
|
277 | - */ |
|
278 | - protected function getResponseObject($modelName, $method, $returnDocBlock) |
|
279 | - { |
|
280 | - $relations = config('core.relations'); |
|
281 | - $relations = Arr::has($relations, $modelName) ? Arr::has($relations[$modelName], $method) ? $relations[$modelName] : false : false; |
|
282 | - $modelName = call_user_func_array("\Core::{$returnDocBlock}", []) ? $returnDocBlock : $modelName; |
|
270 | + /** |
|
271 | + * Get the route response object type. |
|
272 | + * |
|
273 | + * @param string $modelName |
|
274 | + * @param string $method |
|
275 | + * @param string $returnDocBlock |
|
276 | + * @return array |
|
277 | + */ |
|
278 | + protected function getResponseObject($modelName, $method, $returnDocBlock) |
|
279 | + { |
|
280 | + $relations = config('core.relations'); |
|
281 | + $relations = Arr::has($relations, $modelName) ? Arr::has($relations[$modelName], $method) ? $relations[$modelName] : false : false; |
|
282 | + $modelName = call_user_func_array("\Core::{$returnDocBlock}", []) ? $returnDocBlock : $modelName; |
|
283 | 283 | |
284 | - return $relations ? [$modelName => $relations && $relations[$method] ? $relations[$method] : []] : false; |
|
285 | - } |
|
284 | + return $relations ? [$modelName => $relations && $relations[$method] ? $relations[$method] : []] : false; |
|
285 | + } |
|
286 | 286 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | protected function getRoutes() |
92 | 92 | { |
93 | - return collect(\Route::getRoutes())->map(function ($route) { |
|
93 | + return collect(\Route::getRoutes())->map(function($route) { |
|
94 | 94 | if (strpos($route->uri(), 'api/') !== false) { |
95 | 95 | return [ |
96 | 96 | 'method' => $route->methods()[0], |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | ]; |
122 | 122 | |
123 | 123 | |
124 | - if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) { |
|
124 | + if ( ! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) { |
|
125 | 125 | $route['headers']['Authorization'] = 'Bearer {token}'; |
126 | 126 | } |
127 | 127 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | if (count($parameters)) { |
170 | 170 | $className = optional($reflectionMethod->getParameters()[0]->getType())->getName(); |
171 | 171 | if ($className) { |
172 | - $reflectionClass = new \ReflectionClass($className); |
|
172 | + $reflectionClass = new \ReflectionClass($className); |
|
173 | 173 | |
174 | 174 | if ($reflectionClass->hasMethod('rules')) { |
175 | 175 | $reflectionMethod = $reflectionClass->getMethod('rules'); |
@@ -196,8 +196,8 @@ discard block |
||
196 | 196 | { |
197 | 197 | $errors = []; |
198 | 198 | foreach (\Module::all() as $module) { |
199 | - $nameSpace = 'App\\Modules\\' . $module['basename'] ; |
|
200 | - $class = $nameSpace . '\\Errors\\' . $module['basename'] . 'Errors'; |
|
199 | + $nameSpace = 'App\\Modules\\'.$module['basename']; |
|
200 | + $class = $nameSpace.'\\Errors\\'.$module['basename'].'Errors'; |
|
201 | 201 | $reflectionClass = new \ReflectionClass($class); |
202 | 202 | foreach ($reflectionClass->getMethods() as $method) { |
203 | 203 | $methodName = $method->name; |