Commit b918717e authored by Nicolas Widart's avatar Nicolas Widart

Removing dd

parent 6aaf5413
......@@ -22,4 +22,32 @@ class Helper
}
$model->save();
}
public static function separateLanguages($data)
{
$cleanedData = [];
foreach ($data as $key => $value) {
if (is_array($value)) {
foreach ($value as $lang => $input) {
$cleanedData[$lang][$key] = $input;
}
} else {
$cleanedData[$key] = $value;
}
}
return $cleanedData;
}
public static function createTranslatedFields($model, $data)
{
$model = new $model;
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