| @@ -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(Request $request) | 
| 20 | 20 |      { | 
| 21 | -        if($request->locale){ | |
| 21 | +        if ($request->locale) { | |
| 22 | 22 | app()->setLocale($request->locale); | 
| 23 | 23 | $this->locale = app()->getLocale(); | 
| 24 | 24 | } | 
| @@ -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 !== config('seo-manager.locale')){ | |
| 86 | +                if ($type != 'mapping' && $this->locale !== 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 | } | 
| @@ -141,7 +141,7 @@ discard block | ||
| 141 | 141 |      { | 
| 142 | 142 |          $id = $request->get('id'); | 
| 143 | 143 | $seoManager = SeoManagerModel::find($id); | 
| 144 | -        if(is_null($seoManager)){ | |
| 144 | +        if (is_null($seoManager)) { | |
| 145 | 145 | return null; | 
| 146 | 146 | } | 
| 147 | 147 | $ogData = $this->getOgData($seoManager, null); | 
| @@ -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()) | 
| @@ -196,30 +196,30 @@ discard block | ||
| 196 | 196 | private function getMetaData($property) | 
| 197 | 197 |      { | 
| 198 | 198 | $route = \Route::current(); | 
| 199 | -        if (is_null($route)){ | |
| 199 | +        if (is_null($route)) { | |
| 200 | 200 | return null; | 
| 201 | 201 | } | 
| 202 | 202 | $uri = $route->uri(); | 
| 203 | 203 |          $seoManager = SeoManager::where('uri', $uri)->first(); | 
| 204 | -        if(is_null($seoManager)){ | |
| 204 | +        if (is_null($seoManager)) { | |
| 205 | 205 | return null; | 
| 206 | 206 | } | 
| 207 | 207 | $metaData = []; | 
| 208 | -        if(count($seoManager->keywords) > 0){ | |
| 208 | +        if (count($seoManager->keywords) > 0) { | |
| 209 | 209 |              $metaData['keywords'] = implode(', ', $seoManager->keywords); | 
| 210 | 210 | } | 
| 211 | -        if($seoManager->description){ | |
| 211 | +        if ($seoManager->description) { | |
| 212 | 212 | $metaData['description'] = $seoManager->description; | 
| 213 | 213 | } | 
| 214 | -        if($seoManager->title){ | |
| 214 | +        if ($seoManager->title) { | |
| 215 | 215 | $metaData['title'] = $seoManager->title; | 
| 216 | 216 | } | 
| 217 | -        if($seoManager->url){ | |
| 217 | +        if ($seoManager->url) { | |
| 218 | 218 | $metaData['url'] = $seoManager->url; | 
| 219 | -        }else{ | |
| 219 | +        } else { | |
| 220 | 220 | $metaData['url'] = url()->full(); | 
| 221 | 221 | } | 
| 222 | -        if($seoManager->author){ | |
| 222 | +        if ($seoManager->author) { | |
| 223 | 223 | $metaData['author'] = $seoManager->author; | 
| 224 | 224 | } | 
| 225 | 225 |          if ($seoManager->mapping !== null) { | 
| @@ -227,19 +227,19 @@ discard block | ||
| 227 | 227 | } | 
| 228 | 228 |          if ($seoManager->og_data) { | 
| 229 | 229 | $ogData = $this->getOgData($seoManager, $route->parameters); | 
| 230 | -            if($property === 'og_data'){ | |
| 230 | +            if ($property === 'og_data') { | |
| 231 | 231 | $metaData['og_data'] = $ogData; | 
| 232 | -            }else{ | |
| 232 | +            } else { | |
| 233 | 233 |                  foreach ($ogData as $key => $og) { | 
| 234 | 234 | $metaData[$key] = $og; | 
| 235 | 235 | } | 
| 236 | 236 | } | 
| 237 | 237 | } | 
| 238 | 238 | |
| 239 | -        if($property !== null && !empty($property)){ | |
| 240 | -            if(isset($metaData[$property])){ | |
| 239 | +        if ($property !== null && !empty($property)) { | |
| 240 | +            if (isset($metaData[$property])) { | |
| 241 | 241 | return $metaData[$property]; | 
| 242 | -            }else{ | |
| 242 | +            } else { | |
| 243 | 243 | return null; | 
| 244 | 244 | } | 
| 245 | 245 | } | 
| @@ -256,7 +256,7 @@ discard block | ||
| 256 | 256 | private function getDynamicTitle($params, $manager, $routeParams = null) | 
| 257 | 257 |      { | 
| 258 | 258 | $dynamicTitle = ''; | 
| 259 | -        if(is_array($params)){ | |
| 259 | +        if (is_array($params)) { | |
| 260 | 260 |              foreach ($params as $param) { | 
| 261 | 261 |                  if ($this->isParam($param)) { | 
| 262 | 262 | $param = $this->cleanParam($param); | 
| @@ -343,7 +343,7 @@ discard block | ||
| 343 | 343 | $mapped = (new $model); | 
| 344 | 344 |              if ($routeParams) { | 
| 345 | 345 | $mapped = $mapped->where($findBy, $routeParams[$paramsArray[0]])->first(); | 
| 346 | -            }else{ | |
| 346 | +            } else { | |
| 347 | 347 | $mapped = $mapped->first(); | 
| 348 | 348 | } | 
| 349 | 349 | } | 
| @@ -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'); | 
| @@ -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 | } | 
| @@ -6,13 +6,13 @@ discard block | ||
| 6 | 6 |      'prefix' => config('seo-manager.route'), | 
| 7 | 7 | 'as' => 'seo-manager.', | 
| 8 | 8 | 'namespace' => 'Lionix\SeoManager' | 
| 9 | -], function () { | |
| 9 | +], function() { | |
| 10 | 10 |      Route::get('/', 'ManagerController@index')->name('home'); | 
| 11 | 11 |      Route::get('get-routes', 'ManagerController@getRoutes')->name('get-routes'); | 
| 12 | 12 |      Route::get('import-routes', 'ImportController')->name('import'); | 
| 13 | 13 |      Route::get('get-models', 'ManagerController@getModels')->name('get-models'); | 
| 14 | 14 | |
| 15 | -    Route::group(['prefix' => 'locales', 'as' => 'locales.'], function () { | |
| 15 | +    Route::group(['prefix' => 'locales', 'as' => 'locales.'], function() { | |
| 16 | 16 |          Route::get('get-locales', 'LocalesController@getLocales')->name('get'); | 
| 17 | 17 | }); | 
| 18 | 18 | }); | 
| @@ -21,14 +21,14 @@ discard block | ||
| 21 | 21 |      'prefix' => config('seo-manager.route'), | 
| 22 | 22 | 'as' => 'seo-manager.', | 
| 23 | 23 | 'namespace' => 'Lionix\SeoManager' | 
| 24 | -], function () { | |
| 24 | +], function() { | |
| 25 | 25 |      Route::post('delete-route', 'ManagerController@deleteRoute')->name('delete-route'); | 
| 26 | 26 |      Route::post('get-model-columns', 'ManagerController@getModelColumns')->name('get-model-columns'); | 
| 27 | 27 |      Route::post('store-data', 'ManagerController@storeData')->name('store-data'); | 
| 28 | 28 |      Route::post('get-example-title', 'ManagerController@getExampleTitle')->name('get-example-title'); | 
| 29 | 29 |      Route::post('sharing-preview', 'ManagerController@sharingPreview')->name('sharing-preview'); | 
| 30 | 30 | |
| 31 | -    Route::group(['prefix' => 'locales', 'as' => 'locales.'], function () { | |
| 31 | +    Route::group(['prefix' => 'locales', 'as' => 'locales.'], function() { | |
| 32 | 32 |          Route::post('add-locale', 'LocalesController@addLocale')->name('add'); | 
| 33 | 33 | }); | 
| 34 | 34 | }); |