You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
950 B
29 lines
950 B
2 years ago
|
<?php
|
||
|
|
||
|
namespace App\Http\Controllers\Vendor;
|
||
|
|
||
|
use App\CentralLogics\Helpers;
|
||
|
use App\Http\Controllers\Controller;
|
||
|
use App\Models\BusinessSetting;
|
||
|
use Illuminate\Support\Facades\DB;
|
||
|
|
||
|
class LanguageController extends Controller
|
||
|
{
|
||
|
public function lang($local)
|
||
|
{
|
||
|
$direction = BusinessSetting::where('key', 'site_direction')->first();
|
||
|
$direction = $direction->value ?? 'ltr';
|
||
|
$language = BusinessSetting::where('key', 'system_language')->first();
|
||
|
foreach (json_decode($language['value'], true) as $key => $data) {
|
||
|
if ($data['code'] == $local) {
|
||
|
$direction = isset($data['direction']) ? $data['direction'] : 'ltr';
|
||
|
}
|
||
|
}
|
||
|
session()->forget('vendor_language_settings');
|
||
|
Helpers::vendor_language_load();
|
||
|
session()->put('vendor_site_direction', $direction);
|
||
|
session()->put('vendor_local', $local);
|
||
|
return redirect()->back();
|
||
|
}
|
||
|
}
|