diff --git a/src/Controllers/BinshopsReaderController.php b/src/Controllers/BinshopsReaderController.php index 84a665f..3386ca2 100755 --- a/src/Controllers/BinshopsReaderController.php +++ b/src/Controllers/BinshopsReaderController.php @@ -85,7 +85,7 @@ public function index($locale = null, Request $request, $category_slug = null) 'categories' => $rootList, 'posts' => $posts, 'title' => $title, - 'noLocaleRoute' => $request->get("noLocaleRoute") + 'routeWithoutLocale' => $request->get("routeWithoutLocale") ]); } @@ -116,7 +116,7 @@ public function search(Request $request) 'categories' => $rootList, 'query' => $query, 'search_results' => $search_results, - 'noLocaleRoute' => $request->get("noLocaleRoute") + 'routeWithoutLocale' => $request->get("routeWithoutLocale") ] ); } @@ -170,7 +170,7 @@ public function viewSinglePost(Request $request) 'captcha' => $captcha, 'categories' => $categories, 'locale' => $request->get("locale"), - 'noLocaleRoute' => $request->get("noLocaleRoute") + 'routeWithoutLocale' => $request->get("routeWithoutLocale") ]); } } diff --git a/src/Middleware/DetectLanguage.php b/src/Middleware/DetectLanguage.php index 7ef50c4..f25d1a8 100644 --- a/src/Middleware/DetectLanguage.php +++ b/src/Middleware/DetectLanguage.php @@ -1,6 +1,5 @@ route('locale'); - $noLocaleRoute = false; + $routeWithoutLocale = false; if (!$request->route('locale')){ - $noLocaleRoute = true; + $routeWithoutLocale = true; $locale = BinshopsConfiguration::get('DEFAULT_LANGUAGE_LOCALE'); } + $lang = BinshopsLanguage::where('locale', $locale) ->where('active', true) ->first(); @@ -25,10 +25,11 @@ public function handle($request, Closure $next) if (!$lang){ return abort(404); } + $request->attributes->add([ 'lang_id' => $lang->id, 'locale' => $lang->locale, - 'noLocaleRoute' => $noLocaleRoute + 'routeWithoutLocale' => $routeWithoutLocale ]); return $next($request); diff --git a/src/Models/BinshopsCategoryTranslation.php b/src/Models/BinshopsCategoryTranslation.php index 24fb932..f4450d5 100644 --- a/src/Models/BinshopsCategoryTranslation.php +++ b/src/Models/BinshopsCategoryTranslation.php @@ -35,7 +35,7 @@ public function language() * Returns the public facing URL of showing blog posts in this category * @return string */ - public function url($locale, $noLocaleRoute = false) + public function url($locale, $routeWithoutLocale = false) { $theChainString = ""; $cat = $this->category()->get(); @@ -44,7 +44,7 @@ public function url($locale, $noLocaleRoute = false) $theChainString .= "/" . $category->categoryTranslations()->where('lang_id' , $this->lang_id)->first()->slug; } - return $noLocaleRoute ? route("binshopsblog.view_category",["", $theChainString]) : route("binshopsblog.view_category",[$locale, $theChainString]); + return $routeWithoutLocale ? route("binshopsblog.view_category",["", $theChainString]) : route("binshopsblog.view_category",[$locale, $theChainString]); } /** diff --git a/src/Models/BinshopsPostTranslation.php b/src/Models/BinshopsPostTranslation.php index 928a2fa..856de2f 100644 --- a/src/Models/BinshopsPostTranslation.php +++ b/src/Models/BinshopsPostTranslation.php @@ -222,9 +222,9 @@ public function gen_seo_title() * * @return string */ - public function url($loacle, $noLocaleRoute = false) + public function url($loacle, $routeWithoutLocale = false) { - return $noLocaleRoute ? route("binshopsblog.single", ["", $this->slug]) : route("binshopsblog.single", [$loacle, $this->slug]); + return $routeWithoutLocale ? route("binshopsblog.single", ["", $this->slug]) : route("binshopsblog.single", [$loacle, $this->slug]); } /** diff --git a/src/Views/binshopsblog/index.blade.php b/src/Views/binshopsblog/index.blade.php index e7dadbe..0483be3 100755 --- a/src/Views/binshopsblog/index.blade.php +++ b/src/Views/binshopsblog/index.blade.php @@ -64,7 +64,7 @@ class='btn border btn-outline-primary btn-sm '> @include("binshopsblog::partials._category_partial", [ 'category_tree' => $categories, 'name_chain' => $nameChain = "", - 'noLocaleRoute' => $noLocaleRoute + 'routeWithoutLocale' => $routeWithoutLocale ]) @else No Categories diff --git a/src/Views/binshopsblog/partials/_category_partial.blade.php b/src/Views/binshopsblog/partials/_category_partial.blade.php index e2ada1f..7cb577f 100644 --- a/src/Views/binshopsblog/partials/_category_partial.blade.php +++ b/src/Views/binshopsblog/partials/_category_partial.blade.php @@ -4,7 +4,7 @@
  • @php $nameChain = $nameChain .'/'. $trans->slug @endphp - + {{$trans->category_name}} @@ -13,7 +13,7 @@ @include("binshopsblog::partials._category_partial", [ 'category_tree' => $category->siblings, 'name_chain' => $nameChain, - 'noLocaleRoute' => $noLocaleRoute + 'routeWithoutLocale' => $routeWithoutLocale ]) @endif diff --git a/src/Views/binshopsblog/partials/categories.blade.php b/src/Views/binshopsblog/partials/categories.blade.php index 1f6c6be..285bcf6 100644 --- a/src/Views/binshopsblog/partials/categories.blade.php +++ b/src/Views/binshopsblog/partials/categories.blade.php @@ -1,6 +1,6 @@
    @foreach($categories as $category) - + {{$category->categoryTranslations[0]->category_name}} @endforeach diff --git a/src/Views/binshopsblog/partials/index_loop.blade.php b/src/Views/binshopsblog/partials/index_loop.blade.php index 8fa3c0f..4e4c44b 100644 --- a/src/Views/binshopsblog/partials/index_loop.blade.php +++ b/src/Views/binshopsblog/partials/index_loop.blade.php @@ -8,7 +8,7 @@ image_tag("medium", true, ''); ?>
    -

    {{$post->title}}

    +

    {{$post->title}}

    {{$post->subtitle}}
    @if (config('binshopsblog.show_full_text_at_list')) @@ -21,7 +21,7 @@ Authored by: {{$post->post->author->name}} Posted at: {{date('d M Y ', strtotime($post->post->posted_at))}}
    - View Post + View Post