public function lang() { $lang = Idioma::where('codigo', App::getLocale())->where('estado', 'A')->first(); $texto = Texto::join('texto_lang', 'texto_lang.texto_id', '=', 'texto.id')->where('texto_lang.lang_id', $lang->id)->where('texto.id', $this->id)->first(); if (is_null($texto)) { echo "Por null"; $lang = Idioma::where('codigo', 'es')->where('estado', 'A')->first(); $texto = Texto::join('texto_lang', 'texto_lang.texto_id', '=', 'texto.id')->where('texto_lang.lang_id', $lang->id)->where('texto.id', $this->id)->first(); } return $texto; }