mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
40 lines
982 B
PHP
40 lines
982 B
PHP
<?php
|
|
|
|
namespace JoeDixon\Translation\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Routing\Controller;
|
|
use JoeDixon\Translation\Drivers\Translation;
|
|
use JoeDixon\Translation\Http\Requests\LanguageRequest;
|
|
|
|
class LanguageController extends Controller
|
|
{
|
|
private $translation;
|
|
|
|
public function __construct(Translation $translation)
|
|
{
|
|
$this->translation = $translation;
|
|
}
|
|
|
|
public function index(Request $request)
|
|
{
|
|
$languages = $this->translation->allLanguages();
|
|
|
|
return view('translation::languages.index', compact('languages'));
|
|
}
|
|
|
|
public function create()
|
|
{
|
|
return view('translation::languages.create');
|
|
}
|
|
|
|
public function store(LanguageRequest $request)
|
|
{
|
|
$this->translation->addLanguage($request->locale, $request->name);
|
|
|
|
return redirect()
|
|
->route('languages.index')
|
|
->with('success', __('translation::translation.language_added'));
|
|
}
|
|
}
|