Laravel version update
Laravel version update
This commit is contained in:
26
app/Http/ViewComposers/UserLanguage.php
Normal file
26
app/Http/ViewComposers/UserLanguage.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\ViewComposers;
|
||||
|
||||
use Illuminate\View\View;
|
||||
|
||||
class UserLanguage
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public function compose(View $view)
|
||||
{
|
||||
$path = base_path().DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'lang';
|
||||
$langs = scandir($path);
|
||||
$langs = array_diff($langs, ['.', '..']);
|
||||
$languages = [];
|
||||
foreach ($langs as $lang) {
|
||||
$languages[$lang] = \Config::get('languages.'.$lang);
|
||||
}
|
||||
$view->with([
|
||||
'langs' => $languages,
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user