alwardi amir
alwardi amir

Reputation: 29

laravel 6.x : change site title language using localisation

I am developing an application which supports 2 different languages English and Arabic. and i'm using this package: https://github.com/mcamara/laravel-localization .

but i have this problem !

Undefined property: stdClass::$site_meta_title_ (View: C:...

index.blade.php

<title>{{ $config->site_meta_title_ . LaravelLocalization::getCurrentLocale() }}</title>

DB: table: config:

site_meta_title_en and site_meta_title_ar

any help will be highly appreciated.

laravel 6.x

Upvotes: 1

Views: 337

Answers (1)

boolfalse
boolfalse

Reputation: 2131

Didn't used that package before, but I think you need to try like this:

<title>{{ $config->{'site_meta_title_' . LaravelLocalization::getCurrentLocale()} }}</title>

As you've used property of $config instance dynamically, so you need to use like:

$object->{'string_property_name'}

Upvotes: 1

Related Questions