@@ -26,30 +26,30 @@ discard block |
||
| 26 | 26 | /** |
| 27 | 27 | * @param array $data |
| 28 | 28 | * |
| 29 | - * @return mixed |
|
| 29 | + * @return boolean |
|
| 30 | 30 | */ |
| 31 | 31 | public function insert($data = []); |
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * @param array $data |
| 35 | - * @param $entityId |
|
| 35 | + * @param integer $entityId |
|
| 36 | 36 | * |
| 37 | 37 | * @return bool |
| 38 | 38 | */ |
| 39 | 39 | public function update($entityId, $data = []); |
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | - * @param $entityId |
|
| 42 | + * @param integer $entityId |
|
| 43 | 43 | * |
| 44 | - * @return mixed |
|
| 44 | + * @return boolean |
|
| 45 | 45 | */ |
| 46 | 46 | public function delete($entityId); |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | - * @param $entityId |
|
| 49 | + * @param integer $entityId |
|
| 50 | 50 | * @param array $columns |
| 51 | 51 | * |
| 52 | - * @return mixed |
|
| 52 | + * @return Entity |
|
| 53 | 53 | */ |
| 54 | 54 | public function find($entityId, $columns = ['*']); |
| 55 | 55 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * @param array $filters |
| 58 | 58 | * @param array $columns |
| 59 | 59 | * |
| 60 | - * @return mixed |
|
| 60 | + * @return Entity |
|
| 61 | 61 | */ |
| 62 | 62 | public function findBy($filters = [], $columns = ['*']); |
| 63 | 63 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * @param int $limit |
| 74 | 74 | * @param array $filters |
| 75 | 75 | * |
| 76 | - * @return Paginator |
|
| 76 | + * @return \Illuminate\Contracts\Pagination\Paginator |
|
| 77 | 77 | */ |
| 78 | 78 | public function simplePaginate($limit = 10, $filters = []); |
| 79 | 79 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * @param array $filter |
| 98 | 98 | * @param array $columns |
| 99 | 99 | * |
| 100 | - * @return mixed |
|
| 100 | + * @return Entity |
|
| 101 | 101 | */ |
| 102 | 102 | public function first($filter = [], $columns = ['*']); |
| 103 | 103 | |
@@ -140,13 +140,13 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | /** |
| 142 | 142 | * @param int $entityId |
| 143 | - * @return mixed |
|
| 143 | + * @return boolean|null |
|
| 144 | 144 | */ |
| 145 | 145 | public function restore($entityId = 0); |
| 146 | 146 | |
| 147 | 147 | /** |
| 148 | 148 | * @param int $categoryId |
| 149 | - * @return mixed |
|
| 149 | + * @return boolean|null |
|
| 150 | 150 | */ |
| 151 | 151 | public function forceDelete($categoryId = 0); |
| 152 | 152 | } |
@@ -96,7 +96,6 @@ discard block |
||
| 96 | 96 | /** |
| 97 | 97 | * Display a listing of the resource. |
| 98 | 98 | * |
| 99 | - * @param Request $request |
|
| 100 | 99 | * |
| 101 | 100 | * @return \Illuminate\Http\Response |
| 102 | 101 | */ |
@@ -249,7 +248,6 @@ discard block |
||
| 249 | 248 | /** |
| 250 | 249 | * Update the specified resource in storage. |
| 251 | 250 | * |
| 252 | - * @param \Illuminate\Http\Request $request |
|
| 253 | 251 | * @param int $entityId |
| 254 | 252 | * |
| 255 | 253 | * @return \Illuminate\Http\RedirectResponse |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $this->breadcrumbs = new Collection(); |
| 59 | 59 | |
| 60 | 60 | $language = $request->header('Language', 'en'); |
| 61 | - if (! in_array($language, \Config::get('app.locales'))) { |
|
| 61 | + if (!in_array($language, \Config::get('app.locales'))) { |
|
| 62 | 62 | $language = 'en'; |
| 63 | 63 | } |
| 64 | 64 | $limit = $request->get('limit', 10); |
@@ -81,10 +81,10 @@ discard block |
||
| 81 | 81 | $this->interface = $interface; |
| 82 | 82 | $this->isAPI = $request->expectsJson(); |
| 83 | 83 | |
| 84 | - if (! $this->isAPI) { |
|
| 84 | + if (!$this->isAPI) { |
|
| 85 | 85 | $this->breadcrumbs = new Collection(); |
| 86 | 86 | $this->search = new Collection(); |
| 87 | - \View::share('pageTitle', $this->pageTitle.' | '.\Config::get('app.name')); |
|
| 87 | + \View::share('pageTitle', $this->pageTitle . ' | ' . \Config::get('app.name')); |
|
| 88 | 88 | \View::share('breadcrumbs', $this->breadcrumbs); |
| 89 | 89 | \View::share('menu', $this->menu); |
| 90 | 90 | \View::share('search', $this->search); |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | public function index() |
| 104 | 104 | { |
| 105 | 105 | $data = $this->interface->simplePaginate($this->limit, $this->request->all()); |
| 106 | - if (! $this->isAPI) { |
|
| 107 | - \View::share('pageTitle', 'List '.$this->pageTitle.' | '.\Config::get('app.name')); |
|
| 106 | + if (!$this->isAPI) { |
|
| 107 | + \View::share('pageTitle', 'List ' . $this->pageTitle . ' | ' . \Config::get('app.name')); |
|
| 108 | 108 | $this->breadcrumbs->put('index', [ |
| 109 | 109 | 'link' => $this->routeIndex, |
| 110 | 110 | 'text' => $this->pageTitle, |
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | public function create() |
| 137 | 137 | { |
| 138 | - if (! $this->isAPI) { |
|
| 139 | - \View::share('pageTitle', 'Create '.$this->pageTitle.' | '.\Config::get('app.name')); |
|
| 138 | + if (!$this->isAPI) { |
|
| 139 | + \View::share('pageTitle', 'Create ' . $this->pageTitle . ' | ' . \Config::get('app.name')); |
|
| 140 | 140 | $this->breadcrumbs->put('create', [ |
| 141 | 141 | 'link' => $this->createRoute, |
| 142 | 142 | 'text' => trans('common/others.create'), |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | public function baseStore() |
| 157 | 157 | { |
| 158 | 158 | $entity = $this->interface->create($this->request->except(['_token', '_method'])); |
| 159 | - if (! $this->isAPI) { |
|
| 159 | + if (!$this->isAPI) { |
|
| 160 | 160 | if ($entity) { |
| 161 | 161 | return \Redirect::to($this->routeIndex)->with('message', __('messages.success')); |
| 162 | 162 | } |
@@ -187,11 +187,11 @@ discard block |
||
| 187 | 187 | public function show($entityId) |
| 188 | 188 | { |
| 189 | 189 | $entity = $this->interface->find($entityId); |
| 190 | - if (! $this->isAPI) { |
|
| 191 | - if (! $entity) { |
|
| 190 | + if (!$this->isAPI) { |
|
| 191 | + if (!$entity) { |
|
| 192 | 192 | return \Redirect::to($this->routeIndex)->with('warning', __('messages.not_found')); |
| 193 | 193 | } |
| 194 | - \View::share('pageTitle', 'View '.$this->pageTitle.' | '.\Config::get('app.name')); |
|
| 194 | + \View::share('pageTitle', 'View ' . $this->pageTitle . ' | ' . \Config::get('app.name')); |
|
| 195 | 195 | $this->breadcrumbs->put('view', [ |
| 196 | 196 | 'link' => '', |
| 197 | 197 | 'text' => $entity->name ?? $entity->title ?? __('messages.view'), |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | ->with('notes', $this->interface->notes($entityId)) |
| 204 | 204 | ->with('files', $this->interface->files($entityId)); |
| 205 | 205 | } |
| 206 | - if (! $entity) { |
|
| 206 | + if (!$entity) { |
|
| 207 | 207 | return response()->json(null, JsonResponse::HTTP_NOT_FOUND); |
| 208 | 208 | } |
| 209 | 209 | |
@@ -223,8 +223,8 @@ discard block |
||
| 223 | 223 | public function edit($entityId) |
| 224 | 224 | { |
| 225 | 225 | $entity = $this->interface->find($entityId); |
| 226 | - if (! $this->isAPI) { |
|
| 227 | - if (! $entity) { |
|
| 226 | + if (!$this->isAPI) { |
|
| 227 | + if (!$entity) { |
|
| 228 | 228 | return \Redirect::to($this->routeIndex)->with('warning', __('messages.not_found')); |
| 229 | 229 | } |
| 230 | 230 | $this->breadcrumbs->put('edit', [ |
@@ -263,8 +263,8 @@ discard block |
||
| 263 | 263 | $saved = $this->interface->update($entityId, $this->request->except(['_token', '_method'])); |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | - if (! $this->isAPI) { |
|
| 267 | - if (! $entity) { |
|
| 266 | + if (!$this->isAPI) { |
|
| 267 | + if (!$entity) { |
|
| 268 | 268 | return \Redirect::to($this->routeIndex)->with('warning', __('messages.not_found')); |
| 269 | 269 | } |
| 270 | 270 | |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | return \Redirect::to($this->routeIndex)->with('error', __('messages.not_modified')); |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - if (! $entity) { |
|
| 278 | + if (!$entity) { |
|
| 279 | 279 | return response()->json(null, JsonResponse::HTTP_NOT_FOUND); |
| 280 | 280 | } |
| 281 | 281 | |
@@ -304,8 +304,8 @@ discard block |
||
| 304 | 304 | if ($entity) { |
| 305 | 305 | $deleted = $this->interface->delete($entityId); |
| 306 | 306 | } |
| 307 | - if (! $this->isAPI) { |
|
| 308 | - if (! $entity) { |
|
| 307 | + if (!$this->isAPI) { |
|
| 308 | + if (!$entity) { |
|
| 309 | 309 | return \Redirect::to($this->routeIndex)->with('warning', __('messages.not_found')); |
| 310 | 310 | } |
| 311 | 311 | if ($deleted) { |
@@ -336,8 +336,8 @@ discard block |
||
| 336 | 336 | { |
| 337 | 337 | $entity = $this->interface->restore($entityId); |
| 338 | 338 | |
| 339 | - if (! $this->isAPI) { |
|
| 340 | - if (! $entity) { |
|
| 339 | + if (!$this->isAPI) { |
|
| 340 | + if (!$entity) { |
|
| 341 | 341 | return \Redirect::to($this->routeIndex)->with('warning', __('messages.not_found')); |
| 342 | 342 | } |
| 343 | 343 | if ($entity) { |
@@ -369,8 +369,8 @@ discard block |
||
| 369 | 369 | { |
| 370 | 370 | $entity = $this->interface->forceDelete($entityId); |
| 371 | 371 | |
| 372 | - if (! $this->isAPI) { |
|
| 373 | - if (! $entity) { |
|
| 372 | + if (!$this->isAPI) { |
|
| 373 | + if (!$entity) { |
|
| 374 | 374 | return \Redirect::to($this->routeIndex)->with('warning', __('messages.not_found')); |
| 375 | 375 | } |
| 376 | 376 | if ($entity) { |
@@ -93,7 +93,6 @@ |
||
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | - * @param string $name Class name |
|
| 97 | 96 | * @param string $path Class path |
| 98 | 97 | * @param string $folder default path to generate in |
| 99 | 98 | * @param string $type define which kind of files should generate |
@@ -57,17 +57,17 @@ discard block |
||
| 57 | 57 | public function handle() |
| 58 | 58 | { |
| 59 | 59 | |
| 60 | - $file = explode("/", (string)$this->argument('name')); |
|
| 60 | + $file = explode("/", (string) $this->argument('name')); |
|
| 61 | 61 | |
| 62 | - $this->repoName=$file[count($file) - 1]; |
|
| 62 | + $this->repoName = $file[count($file) - 1]; |
|
| 63 | 63 | unset($file[count($file) - 1]); |
| 64 | 64 | $path = implode("/", $file); |
| 65 | 65 | |
| 66 | - if(count($file) == 0){ |
|
| 67 | - $this->repoNamespace=$this->repoName; |
|
| 68 | - }else{ |
|
| 66 | + if (count($file) == 0) { |
|
| 67 | + $this->repoNamespace = $this->repoName; |
|
| 68 | + } else { |
|
| 69 | 69 | $name = $file[count($file) - 1]; |
| 70 | - $this->repoNamespace=implode("\\", $file); |
|
| 70 | + $this->repoNamespace = implode("\\", $file); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $this->generate($path, \Config::get('repository.interfaces_path'), 'Interface'); |
| 78 | 78 | $this->generate($path, \Config::get('repository.repositories_path'), 'Repository'); |
| 79 | 79 | |
| 80 | - File::append(\Config::get('repository.route_path').'web.php', "\n" . 'Route::resource(\'' . str_plural($name) . "', '{$name}Controller');"); |
|
| 80 | + File::append(\Config::get('repository.route_path') . 'web.php', "\n" . 'Route::resource(\'' . str_plural($name) . "', '{$name}Controller');"); |
|
| 81 | 81 | |
| 82 | 82 | } |
| 83 | 83 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | protected function getStub($type) |
| 91 | 91 | { |
| 92 | - return file_get_contents(\Config::get('repository.resources_path')."/stubs/$type.stub"); |
|
| 92 | + return file_get_contents(\Config::get('repository.resources_path') . "/stubs/$type.stub"); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | ], |
| 113 | 113 | $this->getStub($type) |
| 114 | 114 | ); |
| 115 | - $path = $this->checkFolder(\Config::get('repository.app_path').'/'.$folder.$path."/"); |
|
| 115 | + $path = $this->checkFolder(\Config::get('repository.app_path') . '/' . $folder . $path . "/"); |
|
| 116 | 116 | file_put_contents($path . "{$this->repoName}{$type}.php", $template); |
| 117 | 117 | |
| 118 | 118 | } |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | |
| 66 | 66 | if(count($file) == 0){ |
| 67 | 67 | $this->repoNamespace=$this->repoName; |
| 68 | - }else{ |
|
| 68 | + } else{ |
|
| 69 | 69 | $name = $file[count($file) - 1]; |
| 70 | 70 | $this->repoNamespace=implode("\\", $file); |
| 71 | 71 | } |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | * Time: 09:58 ص |
| 7 | 7 | */ |
| 8 | 8 | return [ |
| 9 | - 'app_path' => realpath(__DIR__.'/../app/'), |
|
| 9 | + 'app_path' => realpath(__DIR__ . '/../app/'), |
|
| 10 | 10 | 'route_path' => realpath('routes/'), |
| 11 | 11 | 'resources_path' => realpath('resources/'), |
| 12 | 12 | |
@@ -26,13 +26,13 @@ |
||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | $this->publishes([ |
| 29 | - __DIR__.'/config' => realpath('config'), |
|
| 30 | - ],'repository-config'); |
|
| 29 | + __DIR__ . '/config' => realpath('config'), |
|
| 30 | + ], 'repository-config'); |
|
| 31 | 31 | |
| 32 | - $this->mergeConfigFrom(__DIR__.'/config/repository.php', 'repository-generator'); |
|
| 32 | + $this->mergeConfigFrom(__DIR__ . '/config/repository.php', 'repository-generator'); |
|
| 33 | 33 | $this->publishes([ |
| 34 | - __DIR__.'/stubs' => \Config::get('repository.resources_path',realpath(__DIR__.'/../../../../resources/'))."/stubs/", |
|
| 35 | - ],'repository-stub'); |
|
| 34 | + __DIR__ . '/stubs' => \Config::get('repository.resources_path', realpath(__DIR__ . '/../../../../resources/')) . "/stubs/", |
|
| 35 | + ], 'repository-stub'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -29,14 +29,14 @@ |
||
| 29 | 29 | protected function failedValidation(Validator $validator) |
| 30 | 30 | { |
| 31 | 31 | |
| 32 | - if (strpos($this->path(),'api') !== false) { |
|
| 32 | + if (strpos($this->path(), 'api') !== false) { |
|
| 33 | 33 | $errors = (new ValidationException($validator))->errors(); |
| 34 | 34 | throw new HttpResponseException(response()->json(['success' => false, 'errors' => $errors, |
| 35 | 35 | ], JsonResponse::HTTP_UNPROCESSABLE_ENTITY)); |
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - public function rules(){ |
|
| 40 | - \App::setLocale($this->header('Language','en')); |
|
| 39 | + public function rules() { |
|
| 40 | + \App::setLocale($this->header('Language', 'en')); |
|
| 41 | 41 | } |
| 42 | 42 | } |