public function prueba() { $questions = Question::all(); echo "<h3>Notificaciones:</h3><br>"; $table = "<table border='1'>\n <thead>\n <tr>\n <th>id pregunta</th>\n <th>id usuario</th>\n <th>fecha creacion</th>\n <th>texto</th>\n </tr>\n </thead>\n <tbody>"; foreach ($questions as $question) { $table .= "<tr>\n <th>{$question->id}</th>\n <th>{$question->user_id}</th>\n <th>{$question->texts()->first()->created_at}</th>\n <th>{$question->texts()->first()->description}</th>\n </tr>"; } $table .= "</tbody>\n </table>"; echo $table; }