diff --git a/src/Http/Controllers/LanguageController.php b/src/Http/Controllers/LanguageController.php index 1f1ec58..f945103 100644 --- a/src/Http/Controllers/LanguageController.php +++ b/src/Http/Controllers/LanguageController.php @@ -24,7 +24,7 @@ public function index(Request $request): RedirectResponse $model->save(); } else { $lang = UserLanguage::query() - ->where('model_type', $request->get('model')) + ->where('model_type', app($request->get('model'))->getMorphClass()) ->where('model_id', $request->get('model_id')) ->first(); @@ -33,7 +33,7 @@ public function index(Request $request): RedirectResponse $lang->save(); } else { UserLanguage::query()->create([ - 'model_type' => $request->get('model'), + 'model_type' => app($request->get('model'))->getMorphClass(), 'model_id' => $request->get('model_id'), 'lang' => $request->get('lang'), ]);