@@ -2,8 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | return [ |
| 4 | 4 | |
| 5 | - /** |
|
| 6 | - * Here goes your error messages. |
|
| 7 | - */ |
|
| 5 | + /** |
|
| 6 | + * Here goes your error messages. |
|
| 7 | + */ |
|
| 8 | 8 | |
| 9 | 9 | ]; |
@@ -8,49 +8,49 @@ |
||
| 8 | 8 | |
| 9 | 9 | class ReportService extends BaseService |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * @var UserService |
|
| 13 | - */ |
|
| 14 | - protected $userService; |
|
| 11 | + /** |
|
| 12 | + * @var UserService |
|
| 13 | + */ |
|
| 14 | + protected $userService; |
|
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * Init new object. |
|
| 18 | - * |
|
| 19 | - * @param ReportRepository $repo |
|
| 20 | - * @return void |
|
| 21 | - */ |
|
| 22 | - public function __construct(ReportRepository $repo, UserService $userService) |
|
| 23 | - { |
|
| 24 | - $this->userService = $userService; |
|
| 25 | - parent::__construct($repo); |
|
| 26 | - } |
|
| 16 | + /** |
|
| 17 | + * Init new object. |
|
| 18 | + * |
|
| 19 | + * @param ReportRepository $repo |
|
| 20 | + * @return void |
|
| 21 | + */ |
|
| 22 | + public function __construct(ReportRepository $repo, UserService $userService) |
|
| 23 | + { |
|
| 24 | + $this->userService = $userService; |
|
| 25 | + parent::__construct($repo); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Render the given report db view based on the given |
|
| 30 | - * condition. |
|
| 31 | - * |
|
| 32 | - * @param string $reportName |
|
| 33 | - * @param array $conditions |
|
| 34 | - * @param integer $perPage |
|
| 35 | - * @param boolean $skipPermission |
|
| 36 | - * @return object |
|
| 37 | - */ |
|
| 38 | - public function getReport($reportName, $conditions = [], $perPage = 0, $skipPermission = false) |
|
| 39 | - { |
|
| 40 | - /** |
|
| 41 | - * Fetch the report from db. |
|
| 42 | - */ |
|
| 43 | - $report = $this->repo->first(['report_name' => $reportName]); |
|
| 28 | + /** |
|
| 29 | + * Render the given report db view based on the given |
|
| 30 | + * condition. |
|
| 31 | + * |
|
| 32 | + * @param string $reportName |
|
| 33 | + * @param array $conditions |
|
| 34 | + * @param integer $perPage |
|
| 35 | + * @param boolean $skipPermission |
|
| 36 | + * @return object |
|
| 37 | + */ |
|
| 38 | + public function getReport($reportName, $conditions = [], $perPage = 0, $skipPermission = false) |
|
| 39 | + { |
|
| 40 | + /** |
|
| 41 | + * Fetch the report from db. |
|
| 42 | + */ |
|
| 43 | + $report = $this->repo->first(['report_name' => $reportName]); |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Check report existance and permission. |
|
| 47 | - */ |
|
| 48 | - if (! $report) { |
|
| 49 | - \Errors::notFound('report'); |
|
| 50 | - } elseif (! $skipPermission && ! $this->userService->can($report->view_name, 'report')) { |
|
| 51 | - \Errors::noPermissions(); |
|
| 52 | - } |
|
| 45 | + /** |
|
| 46 | + * Check report existance and permission. |
|
| 47 | + */ |
|
| 48 | + if (! $report) { |
|
| 49 | + \Errors::notFound('report'); |
|
| 50 | + } elseif (! $skipPermission && ! $this->userService->can($report->view_name, 'report')) { |
|
| 51 | + \Errors::noPermissions(); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - return $this->repo->renderReport($report, $conditions, $perPage); |
|
| 55 | - } |
|
| 54 | + return $this->repo->renderReport($report, $conditions, $perPage); |
|
| 55 | + } |
|
| 56 | 56 | } |
@@ -6,45 +6,45 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ApiSkeletonServiceProvider extends ServiceProvider |
| 8 | 8 | {
|
| 9 | - /** |
|
| 10 | - * Perform post-registration booting of services. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function boot() |
|
| 15 | - {
|
|
| 16 | - $this->publishes([ |
|
| 17 | - __DIR__.'/Modules' => app_path('Modules'),
|
|
| 18 | - __DIR__.'/Modules/Core/Resources/Assets' => base_path('public/doc/assets'),
|
|
| 19 | - __DIR__.'/../lang' => base_path('resources/lang'),
|
|
| 20 | - __DIR__.'/../files/Handler.php' => app_path('Exceptions/Handler.php'),
|
|
| 21 | - __DIR__.'/../files/AuthServiceProvider.php' => app_path('Providers/AuthServiceProvider.php'),
|
|
| 22 | - __DIR__.'/../files/BroadcastServiceProvider.php' => app_path('Providers/BroadcastServiceProvider.php'),
|
|
| 23 | - __DIR__.'/../files/Kernel.php' => app_path('Console/Kernel.php'),
|
|
| 24 | - __DIR__.'/../files/HttpKernel.php' => app_path('Http/Kernel.php'),
|
|
| 25 | - __DIR__.'/../files/channels.php' => base_path('routes/channels.php'),
|
|
| 26 | - __DIR__.'/../phpcs.xml' => base_path('/phpcs.xml'),
|
|
| 27 | - __DIR__.'/../docker' => base_path('/docker'),
|
|
| 28 | - __DIR__.'/../docker-compose.yml' => base_path('/docker-compose.yml'),
|
|
| 29 | - __DIR__.'/../.dockerignore' => base_path('/.dockerignore'),
|
|
| 30 | - ]); |
|
| 9 | + /** |
|
| 10 | + * Perform post-registration booting of services. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function boot() |
|
| 15 | + {
|
|
| 16 | + $this->publishes([ |
|
| 17 | + __DIR__.'/Modules' => app_path('Modules'),
|
|
| 18 | + __DIR__.'/Modules/Core/Resources/Assets' => base_path('public/doc/assets'),
|
|
| 19 | + __DIR__.'/../lang' => base_path('resources/lang'),
|
|
| 20 | + __DIR__.'/../files/Handler.php' => app_path('Exceptions/Handler.php'),
|
|
| 21 | + __DIR__.'/../files/AuthServiceProvider.php' => app_path('Providers/AuthServiceProvider.php'),
|
|
| 22 | + __DIR__.'/../files/BroadcastServiceProvider.php' => app_path('Providers/BroadcastServiceProvider.php'),
|
|
| 23 | + __DIR__.'/../files/Kernel.php' => app_path('Console/Kernel.php'),
|
|
| 24 | + __DIR__.'/../files/HttpKernel.php' => app_path('Http/Kernel.php'),
|
|
| 25 | + __DIR__.'/../files/channels.php' => base_path('routes/channels.php'),
|
|
| 26 | + __DIR__.'/../phpcs.xml' => base_path('/phpcs.xml'),
|
|
| 27 | + __DIR__.'/../docker' => base_path('/docker'),
|
|
| 28 | + __DIR__.'/../docker-compose.yml' => base_path('/docker-compose.yml'),
|
|
| 29 | + __DIR__.'/../.dockerignore' => base_path('/.dockerignore'),
|
|
| 30 | + ]); |
|
| 31 | 31 | |
| 32 | - $this->publishes([ |
|
| 33 | - __DIR__.'/../config/skeleton.php' => config_path('skeleton.php'),
|
|
| 34 | - __DIR__.'/../files/auth.php' => config_path('auth.php'),
|
|
| 35 | - ], 'config'); |
|
| 36 | - } |
|
| 32 | + $this->publishes([ |
|
| 33 | + __DIR__.'/../config/skeleton.php' => config_path('skeleton.php'),
|
|
| 34 | + __DIR__.'/../files/auth.php' => config_path('auth.php'),
|
|
| 35 | + ], 'config'); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Register any package services. |
|
| 40 | - * |
|
| 41 | - * @return void |
|
| 42 | - */ |
|
| 43 | - public function register() |
|
| 44 | - {
|
|
| 45 | - $this->mergeConfigFrom( |
|
| 46 | - __DIR__.'/../config/skeleton.php', |
|
| 47 | - 'skeleton' |
|
| 48 | - ); |
|
| 49 | - } |
|
| 38 | + /** |
|
| 39 | + * Register any package services. |
|
| 40 | + * |
|
| 41 | + * @return void |
|
| 42 | + */ |
|
| 43 | + public function register() |
|
| 44 | + {
|
|
| 45 | + $this->mergeConfigFrom( |
|
| 46 | + __DIR__.'/../config/skeleton.php', |
|
| 47 | + 'skeleton' |
|
| 48 | + ); |
|
| 49 | + } |
|
| 50 | 50 | } |