Skip to content

Commit

Permalink
Added logic to LanguageController to respect Relation MorphMap
Browse files Browse the repository at this point in the history
  • Loading branch information
kerwin-wildsea committed Nov 19, 2024
1 parent 650479e commit 4f41db0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Http/Controllers/LanguageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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'),
]);
Expand Down

0 comments on commit 4f41db0

Please sign in to comment.