@@ -91,7 +91,7 @@ |
||
| 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 | } |
@@ -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 | /** @scrutinizer ignore-call */ |
| 23 | 23 | app()->setLocale(Input::get('locale')); |
| 24 | 24 | $this->locale = app()->getLocale(); |
@@ -83,16 +83,16 @@ discard block |
||
| 83 | 83 | $seoManager = SeoManagerModel::find($id); |
| 84 | 84 | if (in_array($type, $allowedColumns)) { |
| 85 | 85 | $data = $request->get($type); |
| 86 | - if($type != 'mapping' && $this->locale !== /** @scrutinizer ignore-call */ config('seo-manager.locale')){ |
|
| 86 | + if ($type != 'mapping' && $this->locale !== /** @scrutinizer ignore-call */ config('seo-manager.locale')) { |
|
| 87 | 87 | $translate = $seoManager->translation()->where('locale', $this->locale)->first(); |
| 88 | - if(!$translate){ |
|
| 88 | + if (!$translate) { |
|
| 89 | 89 | $newInst = new Translate(); |
| 90 | 90 | $newInst->locale = $this->locale; |
| 91 | 91 | $translate = $seoManager->translation()->save($newInst); |
| 92 | 92 | } |
| 93 | 93 | $translate->$type = $data; |
| 94 | 94 | $translate->save(); |
| 95 | - }else{ |
|
| 95 | + } else { |
|
| 96 | 96 | $seoManager->$type = $data; |
| 97 | 97 | $seoManager->save(); |
| 98 | 98 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $this->mergeConfigFrom( |
| 54 | 54 | __DIR__ . '/config/seo-manager.php', 'seo-manager' |
| 55 | 55 | ); |
| 56 | - $this->app->bind('seomanager', function () { |
|
| 56 | + $this->app->bind('seomanager', function() { |
|
| 57 | 57 | return new SeoManager(); |
| 58 | 58 | }); |
| 59 | 59 | $this->app->alias('seomanager', SeoManager::class); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | public function registerBladeDirectives() |
| 77 | 77 | { |
| 78 | 78 | |
| 79 | - Blade::directive('meta', function ($expression) { |
|
| 79 | + Blade::directive('meta', function($expression) { |
|
| 80 | 80 | $meta = ''; |
| 81 | 81 | $expression = trim($expression, '\"\''); |
| 82 | 82 | $metaData = metaData($expression); |
@@ -89,22 +89,22 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | return $meta; |
| 91 | 91 | }); |
| 92 | - Blade::directive('keywords', function () { |
|
| 92 | + Blade::directive('keywords', function() { |
|
| 93 | 93 | return "<meta property='keywords' content='" . metaKeywords() . "'/>"; |
| 94 | 94 | }); |
| 95 | - Blade::directive('url', function () { |
|
| 95 | + Blade::directive('url', function() { |
|
| 96 | 96 | return "<meta property='url' content='" . metaUrl() . "'/>"; |
| 97 | 97 | }); |
| 98 | - Blade::directive('author', function () { |
|
| 98 | + Blade::directive('author', function() { |
|
| 99 | 99 | return "<meta property='author' content='" . metaAuthor() . "'/>"; |
| 100 | 100 | }); |
| 101 | - Blade::directive('description', function () { |
|
| 101 | + Blade::directive('description', function() { |
|
| 102 | 102 | return "<meta property='description' content='" . metaDescription() . "'/>"; |
| 103 | 103 | }); |
| 104 | - Blade::directive('title', function () { |
|
| 104 | + Blade::directive('title', function() { |
|
| 105 | 105 | return "<meta property='title' content='" . metaTitle() . "'/>"; |
| 106 | 106 | }); |
| 107 | - Blade::directive('openGraph', function ($expression) { |
|
| 107 | + Blade::directive('openGraph', function($expression) { |
|
| 108 | 108 | $expression = trim($expression, '\"\''); |
| 109 | 109 | $meta = ''; |
| 110 | 110 | $metaOpenGraph = metaOpenGraph($expression); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | return $meta; |
| 119 | 119 | }); |
| 120 | - Blade::directive('titleDynamic', function () { |
|
| 120 | + Blade::directive('titleDynamic', function() { |
|
| 121 | 121 | return metaTitleDynamic(); |
| 122 | 122 | }); |
| 123 | 123 | } |
@@ -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 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create(/** @scrutinizer ignore-call */config('seo-manager.database.translates_table'), function (Blueprint $table) { |
|
| 16 | + Schema::create(/** @scrutinizer ignore-call */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'); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create(/** @scrutinizer ignore-call */config('seo-manager.database.table'), function (Blueprint $table) { |
|
| 16 | + Schema::create(/** @scrutinizer ignore-call */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(/** @scrutinizer ignore-call */config('seo-manager.database.locales_table'), function (Blueprint $table) { |
|
| 16 | + Schema::create(/** @scrutinizer ignore-call */config('seo-manager.database.locales_table'), function(Blueprint $table) { |
|
| 17 | 17 | $table->increments('id'); |
| 18 | 18 | $table->string('name'); |
| 19 | 19 | $table->timestamps(); |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | 'prefix' => /** @scrutinizer ignore-call */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'); |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | Route::post('get-model-columns', 'ManagerController@getModelColumns')->name('get-model-columns'); |
| 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 | - Route::group(['prefix' => 'locales', 'as' => 'locales.'], function () { |
|
| 17 | + Route::group(['prefix' => 'locales', 'as' => 'locales.'], function() { |
|
| 18 | 18 | Route::get('get-locales', 'LocalesController@getLocales')->name('get'); |
| 19 | 19 | Route::post('add-locale', 'LocalesController@addLocale')->name('add'); |
| 20 | 20 | }); |