@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | public function __construct() |
20 | 20 | { |
21 | - if(Input::get('locale')){ |
|
21 | + if (Input::get('locale')) { |
|
22 | 22 | app()->setLocale(Input::get('locale')); |
23 | 23 | $this->locale = app()->getLocale(); |
24 | 24 | } |
@@ -82,16 +82,16 @@ discard block |
||
82 | 82 | $seoManager = SeoManagerModel::find($id); |
83 | 83 | if (in_array($type, $allowedColumns)) { |
84 | 84 | $data = $request->get($type); |
85 | - if($type != 'mapping' && $this->locale !== config('seo-manager.locale')){ |
|
85 | + if ($type != 'mapping' && $this->locale !== config('seo-manager.locale')) { |
|
86 | 86 | $translate = $seoManager->translation()->where('locale', $this->locale)->first(); |
87 | - if(!$translate){ |
|
87 | + if (!$translate) { |
|
88 | 88 | $newInst = new Translate(); |
89 | 89 | $newInst->locale = $this->locale; |
90 | 90 | $translate = $seoManager->translation()->save($newInst); |
91 | 91 | } |
92 | 92 | $translate->$type = $data; |
93 | 93 | $translate->save(); |
94 | - }else{ |
|
94 | + } else { |
|
95 | 95 | $seoManager->$type = $data; |
96 | 96 | $seoManager->save(); |
97 | 97 | } |
@@ -17,16 +17,16 @@ |
||
17 | 17 | |
18 | 18 | public function addLocale(Request $request) |
19 | 19 | { |
20 | - try{ |
|
20 | + try { |
|
21 | 21 | $locale = Locale::whereName($request->get('name'))->first(); |
22 | - if(!$locale){ |
|
22 | + if (!$locale) { |
|
23 | 23 | $locale = new Locale(); |
24 | 24 | $locale->fill($request->all()); |
25 | 25 | $locale->save(); |
26 | 26 | return /** @scrutinizer ignore-call */ response()->json(['locale' => $locale->name]); |
27 | 27 | } |
28 | 28 | throw new \Exception('Locale is already exist'); |
29 | - }catch (\Exception $exception){ |
|
29 | + } catch (\Exception $exception) { |
|
30 | 30 | return /** @scrutinizer ignore-call */ response()->json(['status' => false, 'message' => $exception->getMessage()], 400); |
31 | 31 | } |
32 | 32 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | return /** @scrutinizer ignore-call */ response()->json(['locale' => $locale->name]); |
27 | 27 | } |
28 | 28 | throw new \Exception('Locale is already exist'); |
29 | - }catch (\Exception $exception){ |
|
29 | + } catch (\Exception $exception){ |
|
30 | 30 | return /** @scrutinizer ignore-call */ response()->json(['status' => false, 'message' => $exception->getMessage()], 400); |
31 | 31 | } |
32 | 32 | } |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | $cleanModelNames = []; |
114 | 114 | foreach ($models as $model) { |
115 | 115 | $modelPath = $this->cleanFilePath($model); |
116 | - $reflectionClass =(new \ReflectionClass($modelPath))->getParentClass(); |
|
117 | - if($reflectionClass !== false){ |
|
118 | - if($reflectionClass->getName() === "Illuminate\Database\Eloquent\Model" || $reflectionClass->getName() === "Illuminate\Foundation\Auth\User"){ |
|
116 | + $reflectionClass = (new \ReflectionClass($modelPath))->getParentClass(); |
|
117 | + if ($reflectionClass !== false) { |
|
118 | + if ($reflectionClass->getName() === "Illuminate\Database\Eloquent\Model" || $reflectionClass->getName() === "Illuminate\Foundation\Auth\User") { |
|
119 | 119 | $cleanModel = [ |
120 | 120 | 'path' => $modelPath, |
121 | 121 | 'name' => str_replace('.php', '', $model->getFilename()) |
@@ -199,21 +199,21 @@ discard block |
||
199 | 199 | $uri = $route->uri(); |
200 | 200 | $seoManager = SeoManager::where('uri', $uri)->first(); |
201 | 201 | $metaData = []; |
202 | - if(count($seoManager->keywords) > 0){ |
|
202 | + if (count($seoManager->keywords) > 0) { |
|
203 | 203 | $metaData['keywords'] = implode(', ', $seoManager->keywords); |
204 | 204 | } |
205 | - if($seoManager->description){ |
|
205 | + if ($seoManager->description) { |
|
206 | 206 | $metaData['description'] = $seoManager->description; |
207 | 207 | } |
208 | - if($seoManager->title){ |
|
208 | + if ($seoManager->title) { |
|
209 | 209 | $metaData['title'] = $seoManager->title; |
210 | 210 | } |
211 | - if($seoManager->url){ |
|
211 | + if ($seoManager->url) { |
|
212 | 212 | $metaData['url'] = $seoManager->url; |
213 | - }else{ |
|
213 | + } else { |
|
214 | 214 | $metaData['url'] = /** @scrutinizer ignore-call */ url()->full(); |
215 | 215 | } |
216 | - if($seoManager->author){ |
|
216 | + if ($seoManager->author) { |
|
217 | 217 | $metaData['author'] = $seoManager->author; |
218 | 218 | } |
219 | 219 | if ($seoManager->mapping !== null) { |
@@ -221,19 +221,19 @@ discard block |
||
221 | 221 | } |
222 | 222 | if ($seoManager->og_data) { |
223 | 223 | $ogData = $this->getOgData($seoManager, $route->parameters); |
224 | - if($property === 'og_data'){ |
|
224 | + if ($property === 'og_data') { |
|
225 | 225 | $metaData['og_data'] = $ogData; |
226 | - }else{ |
|
226 | + } else { |
|
227 | 227 | foreach ($ogData as $key => $og) { |
228 | 228 | $metaData[$key] = $og; |
229 | 229 | } |
230 | 230 | } |
231 | 231 | } |
232 | 232 | |
233 | - if($property !== null && !empty($property)){ |
|
234 | - if(isset($metaData[$property])){ |
|
233 | + if ($property !== null && !empty($property)) { |
|
234 | + if (isset($metaData[$property])) { |
|
235 | 235 | return $metaData[$property]; |
236 | - }else{ |
|
236 | + } else { |
|
237 | 237 | return null; |
238 | 238 | } |
239 | 239 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | private function getDynamicTitle($params, $manager, $routeParams = null) |
251 | 251 | { |
252 | 252 | $dynamicTitle = ''; |
253 | - if(is_array($params)){ |
|
253 | + if (is_array($params)) { |
|
254 | 254 | foreach ($params as $param) { |
255 | 255 | if ($this->isParam($param)) { |
256 | 256 | $param = $this->cleanParam($param); |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $mapped = (new $model); |
336 | 336 | if ($routeParams) { |
337 | 337 | $mapped = $mapped->where($findBy, $routeParams[$paramsArray[0]])->first(); |
338 | - }else{ |
|
338 | + } else { |
|
339 | 339 | $mapped = $mapped->first(); |
340 | 340 | } |
341 | 341 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | } |
211 | 211 | if($seoManager->url){ |
212 | 212 | $metaData['url'] = $seoManager->url; |
213 | - }else{ |
|
213 | + } else{ |
|
214 | 214 | $metaData['url'] = /** @scrutinizer ignore-call */ url()->full(); |
215 | 215 | } |
216 | 216 | if($seoManager->author){ |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $ogData = $this->getOgData($seoManager, $route->parameters); |
224 | 224 | if($property === 'og_data'){ |
225 | 225 | $metaData['og_data'] = $ogData; |
226 | - }else{ |
|
226 | + } else{ |
|
227 | 227 | foreach ($ogData as $key => $og) { |
228 | 228 | $metaData[$key] = $og; |
229 | 229 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | if($property !== null && !empty($property)){ |
234 | 234 | if(isset($metaData[$property])){ |
235 | 235 | return $metaData[$property]; |
236 | - }else{ |
|
236 | + } else{ |
|
237 | 237 | return null; |
238 | 238 | } |
239 | 239 | } |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $mapped = (new $model); |
336 | 336 | if ($routeParams) { |
337 | 337 | $mapped = $mapped->where($findBy, $routeParams[$paramsArray[0]])->first(); |
338 | - }else{ |
|
338 | + } else{ |
|
339 | 339 | $mapped = $mapped->first(); |
340 | 340 | } |
341 | 341 | } |