Commit f6d6de7d by Aan Choesni Herlingga

add translate controller

parent 38936c52
......@@ -25,12 +25,4 @@ class HomeController extends Controller
{
return view('home');
}
public function changeLocale(Request $request)
{
$language = $request->language == 'en' ? 'en' : 'id';
session(['selected_language' => $language]);
return redirect()->back();
}
}
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class TranslateController extends Controller
{
public function changeLocale(Request $request)
{
$language = $request->language == 'en' ? 'en' : 'id';
session(['selected_language' => $language]);
return redirect()->back();
}
}
......@@ -13,5 +13,5 @@
Auth::routes();
Route::post('/change-language', 'HomeController@changeLocale')->name('language');
Route::post('/change-language', 'TranslateController@changeLocale')->name('language');
Route::get('/home', 'HomeController@index')->name('home');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment