public function getTitleAttribute() { $lang = Lang::whereIso(\App::getLocale())->first(); return Translation::where('lang_id', $lang->id)->where('table', $this->table)->where('table_id', $this->id)->first()->key; }
/** * Update translation with key and value * * @param $lang * @param $table * @param $id * @param $value * @param $key * @return mixed */ public function updateKeyValue($lang, $table, $id, $value, $key) { $transaltion = Translation::where('lang_id', $lang)->where('table', $table)->where('table_id', $id)->first(); $transaltion->value = $value; $transaltion->key = strtolower($key); return $transaltion->save(); }
/** * Return the description of spec in multiple langs * @return mixed */ public function getTranslationAttribute() { return Translation::where('table', $this->table)->where('table_id', $this->id)->get(); }