Commit 6aaf5413 authored by Nicolas Widart's avatar Nicolas Widart

Adding local setter. Add language helper class

parent 3f18ea98
<?php <?php
//Route::group(['prefix' => Config::get('core::core.admin-prefix'), 'namespace' => 'Modules\Core\Http\Controllers'], function() /*
//{ |--------------------------------------------------------------------------
// Route::get('/', 'DashboardController@index'); | Language Settings
//}); |--------------------------------------------------------------------------
\ No newline at end of file */
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
App::setLocale('fr');
\ No newline at end of file
<?php namespace Modules\Core\Internationalisation;
/**
* Class Helper
* @package Modules\Core\Internationalisation
*/
class Helper
{
/**
* Save the given model properties in all given languages
* @param $model
* @param $data
*/
public static function saveTranslated($model, $data)
{
foreach ($data as $key => $value) {
if (is_array($value)) {
foreach ($value as $lang => $input) {
$model->translate($lang)->$key = $input;
}
}
}
$model->save();
}
}
\ No newline at end of file
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