pmochine / Laravel-Tongue

🎉 Finally a subdomain localization that works how you want it to work. 🌐
MIT License
40 stars 7 forks source link

Getting erorr when using Route::view & dialect()->current('www') #55

Open AMoktar opened 1 year ago

AMoktar commented 1 year ago

Getting erorr when using

// routes/web.php
Route::view('/privacy', 'privacy')->name('privacy');

// some blade 
@if(tongue()->current() == 'en')
      <a href="{{ dialect()->current('www') }}">
          @lang('text.lang_switch')
      </a>
@endif

the error is TypeError

vendor\pmochine\laravel-tongue\src\Accent\Accent.php : 81
TypeError
str_replace(): Argument #2 ($replace) must be of type string when argument #1 ($search) is a string

public static function substituteAttributesInRoute($attributes, $route)

    {

        foreach ($attributes as $key => $value) {

            $route = str_replace('{'.$key.'}', $value, $route);   // error happens here 

            $route = str_replace('{'.$key.'?}', $value, $route);

        }

Thanks