@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * based on the docblock. |
| 125 | 125 | * |
| 126 | 126 | * @param array &$route |
| 127 | - * @param object $reflectionMethod |
|
| 127 | + * @param \ReflectionMethod $reflectionMethod |
|
| 128 | 128 | * @return void |
| 129 | 129 | */ |
| 130 | 130 | protected function processDocBlock(&$route, $reflectionMethod) |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * Generate post body for the given route. |
| 149 | 149 | * |
| 150 | 150 | * @param array &$route |
| 151 | - * @param object $reflectionMethod |
|
| 151 | + * @param \ReflectionMethod $reflectionMethod |
|
| 152 | 152 | * @param array $validationRules |
| 153 | 153 | * @return void |
| 154 | 154 | */ |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | if ($route) |
| 44 | 44 | { |
| 45 | 45 | $actoinArray = explode('@', $route['action']); |
| 46 | - if(array_get($actoinArray, 1, false)) |
|
| 46 | + if (array_get($actoinArray, 1, false)) |
|
| 47 | 47 | { |
| 48 | 48 | $controller = $actoinArray[0]; |
| 49 | 49 | $method = $actoinArray[1]; |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $route['response'] = $this->getResponseObject($classProperties['model'], $route['name'], $route['returnDocBlock']); |
| 63 | 63 | |
| 64 | 64 | preg_match('/api\/([^#]+)\//iU', $route['uri'], $module); |
| 65 | - $docData['modules'][$module[1]][substr($route['prefix'], strlen('/api/' . $module[1] . '/') - 1)][] = $route; |
|
| 65 | + $docData['modules'][$module[1]][substr($route['prefix'], strlen('/api/'.$module[1].'/') - 1)][] = $route; |
|
| 66 | 66 | |
| 67 | 67 | $this->getModels($classProperties['model'], $docData); |
| 68 | 68 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | protected function getRoutes() |
| 83 | 83 | { |
| 84 | - return collect(\Route::getRoutes())->map(function ($route) { |
|
| 84 | + return collect(\Route::getRoutes())->map(function($route) { |
|
| 85 | 85 | if (strpos($route->uri(), 'api') !== false) |
| 86 | 86 | { |
| 87 | 87 | return [ |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | ]; |
| 114 | 114 | |
| 115 | 115 | |
| 116 | - if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) |
|
| 116 | + if ( ! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) |
|
| 117 | 117 | { |
| 118 | 118 | $route['headers']['Authorization'] = 'Bearer {token}'; |
| 119 | 119 | } |
@@ -167,16 +167,16 @@ discard block |
||
| 167 | 167 | } |
| 168 | 168 | else |
| 169 | 169 | { |
| 170 | - $route['body'] = eval('return ' . str_replace(',\'.$request->get(\'id\')', ',{id}\'', $match[1]) . ';'); |
|
| 170 | + $route['body'] = eval('return '.str_replace(',\'.$request->get(\'id\')', ',{id}\'', $match[1]).';'); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | foreach ($route['body'] as &$rule) |
| 174 | 174 | { |
| 175 | - if(strpos($rule, 'unique')) |
|
| 175 | + if (strpos($rule, 'unique')) |
|
| 176 | 176 | { |
| 177 | 177 | $rule = substr($rule, 0, strpos($rule, 'unique') + 6); |
| 178 | 178 | } |
| 179 | - elseif(strpos($rule, 'exists')) |
|
| 179 | + elseif (strpos($rule, 'exists')) |
|
| 180 | 180 | { |
| 181 | 181 | $rule = substr($rule, 0, strpos($rule, 'exists') - 1); |
| 182 | 182 | } |
@@ -249,10 +249,10 @@ discard block |
||
| 249 | 249 | $model = factory($modelClass)->make(); |
| 250 | 250 | $modelArr = $model->toArray(); |
| 251 | 251 | |
| 252 | - if ( $model->trans && ! $model->trans->count()) |
|
| 252 | + if ($model->trans && ! $model->trans->count()) |
|
| 253 | 253 | { |
| 254 | 254 | $modelArr['trans'] = [ |
| 255 | - 'en' => factory($modelClass . 'Translation')->make()->toArray() |
|
| 255 | + 'en' => factory($modelClass.'Translation')->make()->toArray() |
|
| 256 | 256 | ]; |
| 257 | 257 | } |
| 258 | 258 | |
@@ -164,8 +164,7 @@ discard block |
||
| 164 | 164 | if ($match[1] == '$this->validationRules') |
| 165 | 165 | { |
| 166 | 166 | $route['body'] = $validationRules; |
| 167 | - } |
|
| 168 | - else |
|
| 167 | + } else |
|
| 169 | 168 | { |
| 170 | 169 | $route['body'] = eval('return ' . str_replace(',\'.$request->get(\'id\')', ',{id}\'', $match[1]) . ';'); |
| 171 | 170 | } |
@@ -175,14 +174,12 @@ discard block |
||
| 175 | 174 | if(strpos($rule, 'unique')) |
| 176 | 175 | { |
| 177 | 176 | $rule = substr($rule, 0, strpos($rule, 'unique') + 6); |
| 178 | - } |
|
| 179 | - elseif(strpos($rule, 'exists')) |
|
| 177 | + } elseif(strpos($rule, 'exists')) |
|
| 180 | 178 | { |
| 181 | 179 | $rule = substr($rule, 0, strpos($rule, 'exists') - 1); |
| 182 | 180 | } |
| 183 | 181 | } |
| 184 | - } |
|
| 185 | - else |
|
| 182 | + } else |
|
| 186 | 183 | { |
| 187 | 184 | $route['body'] = 'conditions'; |
| 188 | 185 | } |
@@ -57,29 +57,23 @@ |
||
| 57 | 57 | if ($exception instanceof \Illuminate\Database\QueryException) |
| 58 | 58 | { |
| 59 | 59 | \ErrorHandler::dbQueryError(); |
| 60 | - } |
|
| 61 | - else if ($exception instanceof \predis\connection\connectionexception) |
|
| 60 | + } else if ($exception instanceof \predis\connection\connectionexception) |
|
| 62 | 61 | { |
| 63 | 62 | \ErrorHandler::redisNotRunning(); |
| 64 | - } |
|
| 65 | - else if ($exception instanceof \GuzzleHttp\Exception\ClientException) |
|
| 63 | + } else if ($exception instanceof \GuzzleHttp\Exception\ClientException) |
|
| 66 | 64 | { |
| 67 | 65 | \ErrorHandler::connectionError(); |
| 68 | - } |
|
| 69 | - else if ($exception instanceof \Symfony\Component\HttpKernel\Exception\HttpException) |
|
| 66 | + } else if ($exception instanceof \Symfony\Component\HttpKernel\Exception\HttpException) |
|
| 70 | 67 | { |
| 71 | 68 | return \Response::json($exception->getMessage(), $exception->getStatusCode()); |
| 72 | - } |
|
| 73 | - else if ($exception instanceof \Illuminate\Validation\ValidationException) |
|
| 69 | + } else if ($exception instanceof \Illuminate\Validation\ValidationException) |
|
| 74 | 70 | { |
| 75 | 71 | return \Response::json($exception->errors(), 422); |
| 76 | - } |
|
| 77 | - else if ( ! $exception instanceof \Symfony\Component\Debug\Exception\FatalErrorException) |
|
| 72 | + } else if ( ! $exception instanceof \Symfony\Component\Debug\Exception\FatalErrorException) |
|
| 78 | 73 | { |
| 79 | 74 | return parent::render($request, $exception); |
| 80 | 75 | } |
| 81 | - } |
|
| 82 | - else |
|
| 76 | + } else |
|
| 83 | 77 | { |
| 84 | 78 | return parent::render($request, $exception); |
| 85 | 79 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | { |
| 27 | 27 | $this->registerPolicies(); |
| 28 | 28 | |
| 29 | - Passport::routes(function ($router) { |
|
| 29 | + Passport::routes(function($router) { |
|
| 30 | 30 | $router->forAuthorization(); |
| 31 | 31 | $router->forAccessTokens(); |
| 32 | 32 | $router->forPersonalAccessTokens(); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | Route::group([ |
| 55 | 55 | 'middleware' => 'web', |
| 56 | 56 | 'namespace' => $this->namespace, |
| 57 | - ], function ($router) { |
|
| 57 | + ], function($router) { |
|
| 58 | 58 | require module_path('reporting', 'Routes/web.php'); |
| 59 | 59 | }); |
| 60 | 60 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | 'middleware' => 'api', |
| 73 | 73 | 'namespace' => $this->namespace, |
| 74 | 74 | 'prefix' => 'api', |
| 75 | - ], function ($router) { |
|
| 75 | + ], function($router) { |
|
| 76 | 76 | require module_path('reporting', 'Routes/api.php'); |
| 77 | 77 | }); |
| 78 | 78 | } |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | use Illuminate\Database\Eloquent\Model; |
| 4 | 4 | use Illuminate\Database\Eloquent\SoftDeletes; |
| 5 | 5 | |
| 6 | -class Report extends Model{ |
|
| 6 | +class Report extends Model { |
|
| 7 | 7 | |
| 8 | 8 | use SoftDeletes; |
| 9 | 9 | protected $table = 'reports'; |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | { |
| 41 | 41 | \ErrorHandler::notFound('report'); |
| 42 | 42 | } |
| 43 | - else if (! $skipPermission && ! \Core::users()->can($report->view_name, 'reports')) |
|
| 43 | + else if ( ! $skipPermission && ! \Core::users()->can($report->view_name, 'reports')) |
|
| 44 | 44 | { |
| 45 | 45 | \ErrorHandler::noPermissions(); |
| 46 | 46 | } |
@@ -39,8 +39,7 @@ discard block |
||
| 39 | 39 | if ( ! $report) |
| 40 | 40 | { |
| 41 | 41 | \ErrorHandler::notFound('report'); |
| 42 | - } |
|
| 43 | - else if (! $skipPermission && ! \Core::users()->can($report->view_name, 'reports')) |
|
| 42 | + } else if (! $skipPermission && ! \Core::users()->can($report->view_name, 'reports')) |
|
| 44 | 43 | { |
| 45 | 44 | \ErrorHandler::noPermissions(); |
| 46 | 45 | } |
@@ -61,8 +60,7 @@ discard block |
||
| 61 | 60 | if ($perPage) |
| 62 | 61 | { |
| 63 | 62 | return $report->paginate($perPage); |
| 64 | - } |
|
| 65 | - else |
|
| 63 | + } else |
|
| 66 | 64 | { |
| 67 | 65 | return $report->get(); |
| 68 | 66 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | * to preform actions like (add, edit ... etc). |
| 13 | 13 | * @var string |
| 14 | 14 | */ |
| 15 | - protected $model = 'reports'; |
|
| 15 | + protected $model = 'reports'; |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * List of all route actions that the base api controller |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$factory->define(App\Modules\Reporting\Report::class, function (Faker\Generator $faker) { |
|
| 3 | +$factory->define(App\Modules\Reporting\Report::class, function(Faker\Generator $faker) { |
|
| 4 | 4 | return [ |
| 5 | 5 | 'report_name' => $faker->randomElement(['Users Count', 'Low Stock Products', 'Active Users']), |
| 6 | 6 | 'view_name' => $faker->word(), |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | /** |
| 19 | 19 | * Assign the permissions to the admin group. |
| 20 | 20 | */ |
| 21 | - \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['reports'])->each(function ($permission) use ($adminGroupId) { |
|
| 21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['reports'])->each(function($permission) use ($adminGroupId) { |
|
| 22 | 22 | \DB::table('groups_permissions')->insert( |
| 23 | 23 | [ |
| 24 | 24 | 'permission_id' => $permission->id, |