2016-07-01 23:19:09 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\ViewComposers;
|
|
|
|
|
|
|
|
use Cache;
|
|
|
|
use Illuminate\View\View;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TranslationComposer.php.
|
|
|
|
*
|
|
|
|
* @copyright See LICENSE file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
class TranslationComposer
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Bind data to the view.
|
|
|
|
*
|
2017-01-30 20:40:43 +01:00
|
|
|
* @param View $view
|
2016-07-01 23:19:09 +02:00
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function compose(View $view)
|
|
|
|
{
|
|
|
|
$view->with('industries', Cache::get('industries')->each(function ($industry) {
|
2016-07-02 23:18:13 +02:00
|
|
|
$industry->name = trans('texts.industry_'.$industry->name);
|
2016-07-01 23:19:09 +02:00
|
|
|
})->sortBy(function ($industry) {
|
|
|
|
return $industry->name;
|
|
|
|
}));
|
|
|
|
|
|
|
|
$view->with('countries', Cache::get('countries')->each(function ($country) {
|
2016-07-02 23:18:13 +02:00
|
|
|
$country->name = trans('texts.country_'.$country->name);
|
2016-07-01 23:19:09 +02:00
|
|
|
})->sortBy(function ($country) {
|
|
|
|
return $country->name;
|
|
|
|
}));
|
|
|
|
|
|
|
|
$view->with('paymentTypes', Cache::get('paymentTypes')->each(function ($pType) {
|
2016-07-02 23:18:13 +02:00
|
|
|
$pType->name = trans('texts.payment_type_'.$pType->name);
|
2016-07-01 23:19:09 +02:00
|
|
|
})->sortBy(function ($pType) {
|
|
|
|
return $pType->name;
|
|
|
|
}));
|
|
|
|
|
2016-07-04 01:02:38 +02:00
|
|
|
$view->with('languages', Cache::get('languages')->each(function ($lang) {
|
|
|
|
$lang->name = trans('texts.lang_'.$lang->name);
|
|
|
|
})->sortBy(function ($lang) {
|
|
|
|
return $lang->name;
|
|
|
|
}));
|
2016-07-01 23:19:09 +02:00
|
|
|
}
|
2017-01-30 17:05:31 +01:00
|
|
|
}
|