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.
|
|
|
|
*
|
|
|
|
* @param View $view
|
|
|
|
*
|
|
|
|
* @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;
|
|
|
|
}));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|