@@ -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); |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | public function index() |
103 | 103 | { |
104 | 104 | $data = $this->interface->simplePaginate($this->limit, $this->request->all()); |
105 | - if (! $this->isAPI) { |
|
106 | - \View::share('pageTitle', 'List '.$this->pageTitle.' | '.\Config::get('app.name')); |
|
105 | + if (!$this->isAPI) { |
|
106 | + \View::share('pageTitle', 'List ' . $this->pageTitle . ' | ' . \Config::get('app.name')); |
|
107 | 107 | $this->breadcrumbs->put('index', [ |
108 | 108 | 'link' => $this->routeIndex, |
109 | 109 | 'text' => $this->pageTitle, |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function create() |
133 | 133 | { |
134 | - if (! $this->isAPI) { |
|
135 | - \View::share('pageTitle', 'Create '.$this->pageTitle.' | '.\Config::get('app.name')); |
|
134 | + if (!$this->isAPI) { |
|
135 | + \View::share('pageTitle', 'Create ' . $this->pageTitle . ' | ' . \Config::get('app.name')); |
|
136 | 136 | $this->breadcrumbs->put('create', [ |
137 | 137 | 'link' => $this->createRoute, |
138 | 138 | 'text' => trans('common/others.create'), |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | public function store() |
153 | 153 | { |
154 | 154 | $entity = $this->interface->create($this->request->except(['_token', '_method'])); |
155 | - return $this->makeResponse($entity,true); |
|
155 | + return $this->makeResponse($entity, true); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -165,11 +165,11 @@ discard block |
||
165 | 165 | public function show($entityId) |
166 | 166 | { |
167 | 167 | $entity = $this->interface->find($entityId); |
168 | - if (! $this->isAPI) { |
|
169 | - if (! $entity) { |
|
168 | + if (!$this->isAPI) { |
|
169 | + if (!$entity) { |
|
170 | 170 | return \Redirect::to($this->routeIndex)->with('warning', __('messages.not_found')); |
171 | 171 | } |
172 | - \View::share('pageTitle', 'View '.$this->pageTitle.' | '.\Config::get('app.name')); |
|
172 | + \View::share('pageTitle', 'View ' . $this->pageTitle . ' | ' . \Config::get('app.name')); |
|
173 | 173 | $this->breadcrumbs->put('view', [ |
174 | 174 | 'link' => '', |
175 | 175 | 'text' => $entity->name ?? $entity->title ?? __('messages.view'), |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | return view($this->viewShow, $this->params) |
179 | 179 | ->with('entity', $entity); |
180 | 180 | } |
181 | - if (! $entity) { |
|
181 | + if (!$entity) { |
|
182 | 182 | return response()->json(null, JsonResponse::HTTP_NOT_FOUND); |
183 | 183 | } |
184 | 184 | |
@@ -198,8 +198,8 @@ discard block |
||
198 | 198 | public function edit($entityId) |
199 | 199 | { |
200 | 200 | $entity = $this->interface->find($entityId); |
201 | - if (! $this->isAPI) { |
|
202 | - if (! $entity) { |
|
201 | + if (!$this->isAPI) { |
|
202 | + if (!$entity) { |
|
203 | 203 | return \Redirect::to($this->routeIndex)->with('warning', __('messages.not_found')); |
204 | 204 | } |
205 | 205 | $this->breadcrumbs->put('edit', [ |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | { |
226 | 226 | $entity = $this->interface->update($entityId, $this->request->except(['_token', '_method'])); |
227 | 227 | |
228 | - return $this->makeResponse($entity,true); |
|
228 | + return $this->makeResponse($entity, true); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
@@ -279,9 +279,9 @@ discard block |
||
279 | 279 | * |
280 | 280 | * @return \Illuminate\Http\RedirectResponse |
281 | 281 | */ |
282 | - function makeResponse($entity,$appendEntity = false) |
|
282 | + function makeResponse($entity, $appendEntity = false) |
|
283 | 283 | { |
284 | - if (! $this->isAPI) { |
|
284 | + if (!$this->isAPI) { |
|
285 | 285 | if ($entity) { |
286 | 286 | return \Redirect::to($this->routeIndex)->with('message', __('messages.success')); |
287 | 287 | } |
@@ -294,8 +294,8 @@ discard block |
||
294 | 294 | } |
295 | 295 | |
296 | 296 | if ($entity) { |
297 | - if($appendEntity) |
|
298 | - return response()->json( ['status' => true, 'message' => __('messages.success'), 'data' => $entity], |
|
297 | + if ($appendEntity) |
|
298 | + return response()->json(['status' => true, 'message' => __('messages.success'), 'data' => $entity], |
|
299 | 299 | JsonResponse::HTTP_OK); |
300 | 300 | return response()->json(null, JsonResponse::HTTP_NO_CONTENT); |
301 | 301 | } |