@@ -25,7 +25,7 @@ |
||
25 | 25 | return response()->json(['locale' => $locale->name]); |
26 | 26 | } |
27 | 27 | throw new \Exception('Locale is already exist'); |
28 | - }catch (\Exception $exception){ |
|
28 | + } catch (\Exception $exception){ |
|
29 | 29 | return response()->json(['status' => false, 'message' => $exception->getMessage()], 400); |
30 | 30 | } |
31 | 31 | } |
@@ -24,16 +24,16 @@ |
||
24 | 24 | */ |
25 | 25 | public function addLocale(Request $request) |
26 | 26 | { |
27 | - try{ |
|
27 | + try { |
|
28 | 28 | $locale = Locale::whereName($request->get('name'))->first(); |
29 | - if(!$locale){ |
|
29 | + if (!$locale) { |
|
30 | 30 | $locale = new Locale(); |
31 | 31 | $locale->fill($request->all()); |
32 | 32 | $locale->save(); |
33 | 33 | return response()->json(['locale' => $locale->name]); |
34 | 34 | } |
35 | 35 | throw new \Exception('Locale is already exist'); |
36 | - }catch (\Exception $exception){ |
|
36 | + } catch (\Exception $exception) { |
|
37 | 37 | return response()->json(['status' => false, 'message' => $exception->getMessage()], 400); |
38 | 38 | } |
39 | 39 | } |
@@ -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'] = 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 | } |
@@ -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()) |
@@ -198,25 +198,25 @@ discard block |
||
198 | 198 | $route = \Route::current(); |
199 | 199 | $uri = $route->uri(); |
200 | 200 | $seoManager = SeoManager::where('uri', $uri)->first(); |
201 | - if(is_null($seoManager)){ |
|
201 | + if (is_null($seoManager)) { |
|
202 | 202 | return null; |
203 | 203 | } |
204 | 204 | $metaData = []; |
205 | - if(count($seoManager->keywords) > 0){ |
|
205 | + if (count($seoManager->keywords) > 0) { |
|
206 | 206 | $metaData['keywords'] = implode(', ', $seoManager->keywords); |
207 | 207 | } |
208 | - if($seoManager->description){ |
|
208 | + if ($seoManager->description) { |
|
209 | 209 | $metaData['description'] = $seoManager->description; |
210 | 210 | } |
211 | - if($seoManager->title){ |
|
211 | + if ($seoManager->title) { |
|
212 | 212 | $metaData['title'] = $seoManager->title; |
213 | 213 | } |
214 | - if($seoManager->url){ |
|
214 | + if ($seoManager->url) { |
|
215 | 215 | $metaData['url'] = $seoManager->url; |
216 | - }else{ |
|
216 | + } else { |
|
217 | 217 | $metaData['url'] = url()->full(); |
218 | 218 | } |
219 | - if($seoManager->author){ |
|
219 | + if ($seoManager->author) { |
|
220 | 220 | $metaData['author'] = $seoManager->author; |
221 | 221 | } |
222 | 222 | if ($seoManager->mapping !== null) { |
@@ -224,19 +224,19 @@ discard block |
||
224 | 224 | } |
225 | 225 | if ($seoManager->og_data) { |
226 | 226 | $ogData = $this->getOgData($seoManager, $route->parameters); |
227 | - if($property === 'og_data'){ |
|
227 | + if ($property === 'og_data') { |
|
228 | 228 | $metaData['og_data'] = $ogData; |
229 | - }else{ |
|
229 | + } else { |
|
230 | 230 | foreach ($ogData as $key => $og) { |
231 | 231 | $metaData[$key] = $og; |
232 | 232 | } |
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | - if($property !== null && !empty($property)){ |
|
237 | - if(isset($metaData[$property])){ |
|
236 | + if ($property !== null && !empty($property)) { |
|
237 | + if (isset($metaData[$property])) { |
|
238 | 238 | return $metaData[$property]; |
239 | - }else{ |
|
239 | + } else { |
|
240 | 240 | return null; |
241 | 241 | } |
242 | 242 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | private function getDynamicTitle($params, $manager, $routeParams = null) |
254 | 254 | { |
255 | 255 | $dynamicTitle = ''; |
256 | - if(is_array($params)){ |
|
256 | + if (is_array($params)) { |
|
257 | 257 | foreach ($params as $param) { |
258 | 258 | if ($this->isParam($param)) { |
259 | 259 | $param = $this->cleanParam($param); |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | $mapped = (new $model); |
341 | 341 | if ($routeParams) { |
342 | 342 | $mapped = $mapped->where($findBy, $routeParams[$paramsArray[0]])->first(); |
343 | - }else{ |
|
343 | + } else { |
|
344 | 344 | $mapped = $mapped->first(); |
345 | 345 | } |
346 | 346 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create(config('seo-manager.database.locales_table'), function (Blueprint $table) { |
|
16 | + Schema::create(config('seo-manager.database.locales_table'), function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | 18 | $table->string('name'); |
19 | 19 | $table->timestamps(); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create(config('seo-manager.database.table'), function (Blueprint $table) { |
|
16 | + Schema::create(config('seo-manager.database.table'), function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | 18 | $table->string('uri')->nullable(); |
19 | 19 | $table->jsonb('params')->nullable(); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create(config('seo-manager.database.translates_table'), function (Blueprint $table) { |
|
16 | + Schema::create(config('seo-manager.database.translates_table'), function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | 18 | $table->integer('route_id'); |
19 | 19 | $table->string('locale'); |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | 'prefix' => config('seo-manager.route'), |
6 | 6 | 'as' => 'seo-manager.', |
7 | 7 | 'namespace' => 'Lionix\SeoManager' |
8 | -], function () { |
|
8 | +], function() { |
|
9 | 9 | Route::get('/', 'ManagerController@index')->name('home'); |
10 | 10 | Route::get('get-routes', 'ManagerController@getRoutes')->name('get-routes'); |
11 | 11 | Route::get('import-routes', 'ImportController')->name('import'); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | Route::post('store-data', 'ManagerController@storeData')->name('store-data'); |
16 | 16 | Route::post('get-example-title', 'ManagerController@getExampleTitle')->name('get-example-title'); |
17 | 17 | Route::post('sharing-preview', 'ManagerController@sharingPreview')->name('sharing-preview'); |
18 | - Route::group(['prefix' => 'locales', 'as' => 'locales.'], function () { |
|
18 | + Route::group(['prefix' => 'locales', 'as' => 'locales.'], function() { |
|
19 | 19 | Route::get('get-locales', 'LocalesController@getLocales')->name('get'); |
20 | 20 | Route::post('add-locale', 'LocalesController@addLocale')->name('add'); |
21 | 21 | }); |
@@ -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 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | { |
141 | 141 | $id = $request->get('id'); |
142 | 142 | $seoManager = SeoManagerModel::find($id); |
143 | - if(is_null($seoManager)){ |
|
143 | + if (is_null($seoManager)) { |
|
144 | 144 | return null; |
145 | 145 | } |
146 | 146 | $ogData = $this->getOgData($seoManager, null); |