Laravel-Tongue icon indicating copy to clipboard operation
Laravel-Tongue copied to clipboard

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

Open AMoktar opened this issue 1 year ago • 0 comments

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

AMoktar avatar Aug 24 '23 13:08 AMoktar