@@ -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 |
@@ -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 | } |
@@ -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 | /** |
@@ -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) { |
@@ -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 | } |