@@ -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 | - return $this->makeResponse($entity,true); |
|
154 | + return $this->makeResponse($entity, true); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | public function show($entityId) |
165 | 165 | { |
166 | 166 | $entity = $this->interface->find($entityId); |
167 | - if (! $this->isAPI) { |
|
168 | - if (! $entity) { |
|
167 | + if (!$this->isAPI) { |
|
168 | + if (!$entity) { |
|
169 | 169 | return \Redirect::to($this->routeIndex)->with('warning', __('messages.not_found')); |
170 | 170 | } |
171 | - \View::share('pageTitle', 'View '.$this->pageTitle.' | '.\Config::get('app.name')); |
|
171 | + \View::share('pageTitle', 'View ' . $this->pageTitle . ' | ' . \Config::get('app.name')); |
|
172 | 172 | $this->breadcrumbs->put('view', [ |
173 | 173 | 'link' => '', |
174 | 174 | 'text' => $entity->name ?? $entity->title ?? __('messages.view'), |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | return view($this->viewShow, $this->params) |
178 | 178 | ->with('entity', $entity); |
179 | 179 | } |
180 | - if (! $entity) { |
|
180 | + if (!$entity) { |
|
181 | 181 | return response()->json(null, JsonResponse::HTTP_NOT_FOUND); |
182 | 182 | } |
183 | 183 | |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | public function edit($entityId) |
198 | 198 | { |
199 | 199 | $entity = $this->interface->find($entityId); |
200 | - if (! $this->isAPI) { |
|
201 | - if (! $entity) { |
|
200 | + if (!$this->isAPI) { |
|
201 | + if (!$entity) { |
|
202 | 202 | return \Redirect::to($this->routeIndex)->with('warning', __('messages.not_found')); |
203 | 203 | } |
204 | 204 | $this->breadcrumbs->put('edit', [ |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | { |
225 | 225 | $entity = $this->interface->update($entityId, $this->request->except(['_token', '_method'])); |
226 | 226 | |
227 | - return $this->makeResponse($entity,ture); |
|
227 | + return $this->makeResponse($entity, ture); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | /** |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | * |
279 | 279 | * @return \Illuminate\Http\RedirectResponse |
280 | 280 | */ |
281 | - function makeResponse($entity,$appendEntity = false) |
|
281 | + function makeResponse($entity, $appendEntity = false) |
|
282 | 282 | { |
283 | - if (! $this->isAPI) { |
|
283 | + if (!$this->isAPI) { |
|
284 | 284 | if ($entity) { |
285 | 285 | return \Redirect::to($this->routeIndex)->with('message', __('messages.success')); |
286 | 286 | } |
@@ -293,8 +293,8 @@ discard block |
||
293 | 293 | } |
294 | 294 | |
295 | 295 | if ($entity) { |
296 | - if($appendEntity) |
|
297 | - return response()->json( ['status' => true, 'message' => __('messages.success'), 'data' => $entity], |
|
296 | + if ($appendEntity) |
|
297 | + return response()->json(['status' => true, 'message' => __('messages.success'), 'data' => $entity], |
|
298 | 298 | JsonResponse::HTTP_OK); |
299 | 299 | return response()->json(null, JsonResponse::HTTP_NO_CONTENT); |
300 | 300 | } |
@@ -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']; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | { |
159 | 159 | $item = $this->model->findOrFail('id'); |
160 | 160 | |
161 | - if($item->update($attributes)) |
|
161 | + if ($item->update($attributes)) |
|
162 | 162 | { |
163 | 163 | return $item; |
164 | 164 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | */ |
222 | 222 | public function find($entityId = 0, $columns = ['*']) |
223 | 223 | { |
224 | - return $this->model->with($this->with)->find($entityId,$columns); |
|
224 | + return $this->model->with($this->with)->find($entityId, $columns); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | */ |
233 | 233 | public function findOrFail($entityId = 0, $columns = ['*']) |
234 | 234 | { |
235 | - return $this->model->with($this->with)->findOrFail($entityId,$columns); |
|
235 | + return $this->model->with($this->with)->findOrFail($entityId, $columns); |
|
236 | 236 | } |
237 | 237 | /** |
238 | 238 | * @param array $filter |