@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function handle() |
57 | 57 | { |
58 | - $file = explode("/", (string)$this->argument('name')); |
|
58 | + $file = explode("/", (string) $this->argument('name')); |
|
59 | 59 | |
60 | 60 | $this->repoName = $file[count($file) - 1]; |
61 | 61 | unset($file[count($file) - 1]); |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | $this->repoNamespace = $file[count($file) - 1]; |
68 | 68 | $this->repoNamespace = implode("\\", $file); |
69 | 69 | } |
70 | - $model= str_plural(\Config::get('repository.model')); |
|
71 | - $interface= str_plural(\Config::get('repository.interface')); |
|
72 | - $repository= str_plural(\Config::get('repository.repository')); |
|
70 | + $model = str_plural(\Config::get('repository.model')); |
|
71 | + $interface = str_plural(\Config::get('repository.interface')); |
|
72 | + $repository = str_plural(\Config::get('repository.repository')); |
|
73 | 73 | |
74 | 74 | $this->generate($path, \Config::get('repository.controllers_path'), 'Controller'); |
75 | 75 | $this->generate($path, $model, 'Entity'); |
@@ -112,10 +112,10 @@ discard block |
||
112 | 112 | $this->getStub($type) |
113 | 113 | ); |
114 | 114 | $filePath = $this->checkFolder(\Config::get('repository.app_path') . "/{$folder}/{$path}/"); |
115 | - if($type == 'Entity') |
|
115 | + if ($type == 'Entity') |
|
116 | 116 | { |
117 | 117 | file_put_contents($filePath . "{$this->repoName}.php", $template); |
118 | - }else |
|
118 | + } else |
|
119 | 119 | { |
120 | 120 | file_put_contents($filePath . "{$this->repoName}{$type}.php", $template); |
121 | 121 | } |
@@ -115,7 +115,7 @@ |
||
115 | 115 | if($type == 'Entity') |
116 | 116 | { |
117 | 117 | file_put_contents($filePath . "{$this->repoName}.php", $template); |
118 | - }else |
|
118 | + } else |
|
119 | 119 | { |
120 | 120 | file_put_contents($filePath . "{$this->repoName}{$type}.php", $template); |
121 | 121 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $this->breadcrumbs = new Collection(); |
58 | 58 | |
59 | 59 | $language = $request->header('Language', 'en'); |
60 | - if (! in_array($language, \Config::get('app.locales', []))) { |
|
60 | + if (!in_array($language, \Config::get('app.locales', []))) { |
|
61 | 61 | $language = 'en'; |
62 | 62 | } |
63 | 63 | $limit = $request->get('limit', 10); |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | $this->interface = $interface; |
81 | 81 | $this->isAPI = $request->expectsJson(); |
82 | 82 | |
83 | - if (! $this->isAPI) { |
|
83 | + if (!$this->isAPI) { |
|
84 | 84 | $this->breadcrumbs = new Collection(); |
85 | 85 | $this->search = new Collection(); |
86 | - \View::share('pageTitle', $this->pageTitle.' | '.\Config::get('app.name')); |
|
86 | + \View::share('pageTitle', $this->pageTitle . ' | ' . \Config::get('app.name')); |
|
87 | 87 | \View::share('breadcrumbs', $this->breadcrumbs); |
88 | 88 | \View::share('menu', $this->menu); |
89 | 89 | \View::share('search', $this->search); |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | public function index() |
102 | 102 | { |
103 | 103 | $data = $this->interface->simplePaginate($this->limit, $this->request->all()); |
104 | - if (! $this->isAPI) { |
|
105 | - \View::share('pageTitle', 'List '.$this->pageTitle.' | '.\Config::get('app.name')); |
|
104 | + if (!$this->isAPI) { |
|
105 | + \View::share('pageTitle', 'List ' . $this->pageTitle . ' | ' . \Config::get('app.name')); |
|
106 | 106 | $this->breadcrumbs->put('index', [ |
107 | 107 | 'link' => $this->routeIndex, |
108 | 108 | 'text' => $this->pageTitle, |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function create() |
132 | 132 | { |
133 | - if (! $this->isAPI) { |
|
134 | - \View::share('pageTitle', 'Create '.$this->pageTitle.' | '.\Config::get('app.name')); |
|
133 | + if (!$this->isAPI) { |
|
134 | + \View::share('pageTitle', 'Create ' . $this->pageTitle . ' | ' . \Config::get('app.name')); |
|
135 | 135 | $this->breadcrumbs->put('create', [ |
136 | 136 | 'link' => $this->createRoute, |
137 | 137 | 'text' => trans('common/others.create'), |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | public function store() |
152 | 152 | { |
153 | 153 | $entity = $this->interface->create($this->request->except(['_token', '_method'])); |
154 | - if (! $this->isAPI) { |
|
154 | + if (!$this->isAPI) { |
|
155 | 155 | if ($entity) { |
156 | 156 | return \Redirect::to($this->routeIndex)->with('message', __('messages.success')); |
157 | 157 | } |
@@ -182,11 +182,11 @@ discard block |
||
182 | 182 | public function show($entityId) |
183 | 183 | { |
184 | 184 | $entity = $this->interface->find($entityId); |
185 | - if (! $this->isAPI) { |
|
186 | - if (! $entity) { |
|
185 | + if (!$this->isAPI) { |
|
186 | + if (!$entity) { |
|
187 | 187 | return \Redirect::to($this->routeIndex)->with('warning', __('messages.not_found')); |
188 | 188 | } |
189 | - \View::share('pageTitle', 'View '.$this->pageTitle.' | '.\Config::get('app.name')); |
|
189 | + \View::share('pageTitle', 'View ' . $this->pageTitle . ' | ' . \Config::get('app.name')); |
|
190 | 190 | $this->breadcrumbs->put('view', [ |
191 | 191 | 'link' => '', |
192 | 192 | 'text' => $entity->name ?? $entity->title ?? __('messages.view'), |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | return view($this->viewShow, $this->params) |
196 | 196 | ->with('entity', $entity); |
197 | 197 | } |
198 | - if (! $entity) { |
|
198 | + if (!$entity) { |
|
199 | 199 | return response()->json(null, JsonResponse::HTTP_NOT_FOUND); |
200 | 200 | } |
201 | 201 | |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | public function edit($entityId) |
216 | 216 | { |
217 | 217 | $entity = $this->interface->find($entityId); |
218 | - if (! $this->isAPI) { |
|
219 | - if (! $entity) { |
|
218 | + if (!$this->isAPI) { |
|
219 | + if (!$entity) { |
|
220 | 220 | return \Redirect::to($this->routeIndex)->with('warning', __('messages.not_found')); |
221 | 221 | } |
222 | 222 | $this->breadcrumbs->put('edit', [ |
@@ -248,8 +248,8 @@ discard block |
||
248 | 248 | $saved = $this->interface->update($entityId, $this->request->except(['_token', '_method'])); |
249 | 249 | } |
250 | 250 | |
251 | - if (! $this->isAPI) { |
|
252 | - if (! $entity) { |
|
251 | + if (!$this->isAPI) { |
|
252 | + if (!$entity) { |
|
253 | 253 | return \Redirect::to($this->routeIndex)->with('warning', __('messages.not_found')); |
254 | 254 | } |
255 | 255 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | return \Redirect::to($this->routeIndex)->with('error', __('messages.not_modified')); |
261 | 261 | } |
262 | 262 | |
263 | - if (! $entity) { |
|
263 | + if (!$entity) { |
|
264 | 264 | return response()->json(null, JsonResponse::HTTP_NOT_FOUND); |
265 | 265 | } |
266 | 266 | |
@@ -329,9 +329,9 @@ discard block |
||
329 | 329 | * |
330 | 330 | * @return \Illuminate\Http\RedirectResponse |
331 | 331 | */ |
332 | - function makeResponse($entity,$appendEntity = false) |
|
332 | + function makeResponse($entity, $appendEntity = false) |
|
333 | 333 | { |
334 | - if (! $this->isAPI) { |
|
334 | + if (!$this->isAPI) { |
|
335 | 335 | if ($entity) { |
336 | 336 | return \Redirect::to($this->routeIndex)->with('message', __('messages.success')); |
337 | 337 | } |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | } |
345 | 345 | |
346 | 346 | if ($entity) { |
347 | - if($appendEntity) |
|
348 | - return response()->json( ['status' => true, 'message' => __('messages.success'), 'data' => $entity], |
|
347 | + if ($appendEntity) |
|
348 | + return response()->json(['status' => true, 'message' => __('messages.success'), 'data' => $entity], |
|
349 | 349 | JsonResponse::HTTP_OK); |
350 | 350 | return response()->json(null, JsonResponse::HTTP_NO_CONTENT); |
351 | 351 | } |
@@ -344,9 +344,10 @@ |
||
344 | 344 | } |
345 | 345 | |
346 | 346 | if ($entity) { |
347 | - if($appendEntity) |
|
348 | - return response()->json( ['status' => true, 'message' => __('messages.success'), 'data' => $entity], |
|
347 | + if($appendEntity) { |
|
348 | + return response()->json( ['status' => true, 'message' => __('messages.success'), 'data' => $entity], |
|
349 | 349 | JsonResponse::HTTP_OK); |
350 | + } |
|
350 | 351 | return response()->json(null, JsonResponse::HTTP_NO_CONTENT); |
351 | 352 | } |
352 | 353 |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function filter($criteria = []) |
80 | 80 | { |
81 | - $criteria= $this->order($criteria); |
|
81 | + $criteria = $this->order($criteria); |
|
82 | 82 | |
83 | 83 | /** @var Entity $latest */ |
84 | 84 | $latest = $this->model->with($this->with); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @return array |
113 | 113 | */ |
114 | - private function order($criteria=[]){ |
|
114 | + private function order($criteria = []) { |
|
115 | 115 | |
116 | 116 | if (isset($criteria['order'])) { |
117 | 117 | $this->order = $criteria['order']; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public function find($entityId = 0, $columns = ['*']) |
222 | 222 | { |
223 | - return $this->model->with($this->with)->find($entityId,$columns); |
|
223 | + return $this->model->with($this->with)->find($entityId, $columns); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | /** |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | */ |
232 | 232 | public function findOrFail($entityId = 0, $columns = ['*']) |
233 | 233 | { |
234 | - return $this->model->with($this->with)->findOrFail($entityId,$columns); |
|
234 | + return $this->model->with($this->with)->findOrFail($entityId, $columns); |
|
235 | 235 | } |
236 | 236 | /** |
237 | 237 | * @param array $filter |
@@ -26,16 +26,16 @@ |
||
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 | 32 | if ($this->app['config']->get('repository') === null) { |
33 | - $this->app['config']->set('repository', require __DIR__.'/config/repository.php'); |
|
33 | + $this->app['config']->set('repository', require __DIR__ . '/config/repository.php'); |
|
34 | 34 | } |
35 | - $this->mergeConfigFrom(__DIR__.'/config/repository.php', 'repository-config'); |
|
35 | + $this->mergeConfigFrom(__DIR__ . '/config/repository.php', 'repository-config'); |
|
36 | 36 | $this->publishes([ |
37 | - realpath(__DIR__ . '/../stubs') => \Config::get('repository.resources_path',realpath(__DIR__.'/../../../../resources/')), |
|
38 | - ],'repository-stub'); |
|
37 | + realpath(__DIR__ . '/../stubs') => \Config::get('repository.resources_path', realpath(__DIR__ . '/../../../../resources/')), |
|
38 | + ], 'repository-stub'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |