DEV Community

mustaphannoo
mustaphannoo

Posted on

i am new in laravel

hy guys can you help me for this issues i want to create more d'un model in this methode :

if (isset($segments[1])) {
return $this->resolveModel(Category::class, $segments[1], $locale);

}

i want to replace category::class by dynamic model

this my method

if (array_key_exists($locale, config('locales.languages'))){
App::setLocale($locale);
Lang::setLocale($locale);
setlocale(LC_TIME, config('locales.languages')[$locale]['UNICODE']);
Carbon::setLocale(config('locales.languages')[$locale]['lang']);
Session::put('locale', $locale);

        if(config('locales.languages')[$locale]['rtl_support'] == 'rtl'){
            Session::put('lang-rtl', true);
        }   else {
                Session::forget('lang-rtl');
            }

            if (isset($segments[1])) {
                    return $this->resolveModel(Category::class, $segments[1], $locale);
            }
            return redirect()->back();
    }
Enter fullscreen mode Exit fullscreen mode

thanks for everyone

Top comments (0)