FleetCart/Modules/Translation/Http/Controllers/Admin/TranslationController.php
2023-06-11 13:14:03 +01:00

39 lines
993 B
PHP

<?php
namespace Modules\Translation\Http\Controllers\Admin;
use Modules\Translation\Entities\Translation;
class TranslationController
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$translations = Translation::retrieve();
return view('translation::admin.translations.index', compact('translations'));
}
/**
* Update the specified resource in storage.
*
* @param string $key
* @return \Illuminate\Http\Response
*/
public function update($key)
{
Translation::firstOrCreate(['key' => $key])
->translations()
->updateOrCreate(
['locale' => request('locale')],
['value' => request('value', '')]
);
return trans('admin::messages.resource_saved', ['resource' => trans('translation::translations.translation')]);
}
}