public static function getFacadeRoot() { return Locale::instance(); }
/** * Get all translation of model and fill for save * * @param array $data * @param array $exclude * @return $this */ public function expand(array $data = [], $exclude = ['content']) { foreach (\Amari\Translatable\Services\Locale::instance()->otherLangs() as $lang => $id) { $tranModel = $this->cloneMorph($lang); foreach ($this->getJson() as $field => $options) { foreach ($options as $param) { $paramName = $param . '__' . $lang . '__'; $this->{$paramName} = $tranModel->{$param}; } } foreach ($this->getTranslatable() as $param) { if (!in_array($param, $exclude)) { $paramName = $param . '__' . $lang . '__'; $this->{$paramName} = $tranModel->{$param}; } } } foreach ($data as $item => $value) { $this->{$item} = $value; } return $this; }