0

How can I print a enter image description here

My Controller is redirecting to this View with flash data(data from a table row). How do I print for example, just the "titulo" or "resumo"?

Or, instead of sending all the information from a table row to a single variable, do I have to send separately into different variables?

Thanks in advance.

CodeOnce
  • 79
  • 1
  • 9
  • Is there a reason you add database data to your session instead of passing it from the controller to the view? Because performance-wise, this is not the best thing to do. – Namoshek Dec 08 '18 at 16:16
  • Show us your controller method. – Camilo Dec 08 '18 at 16:16
  • And the controller method behind the route where you redirect to does simply display a view? That's overcomplicating things. – Namoshek Dec 08 '18 at 16:27
  • I have a page that shows a brief information about a topic, and when I click on it my controller will receive an ID and then return a view to a new page with the full information about that same topic – CodeOnce Dec 08 '18 at 16:29
  • This full information count as : Title, Date , Content, Image , Tags || The brief information count as: Title, Date, Resume, Image, Tags – CodeOnce Dec 08 '18 at 16:32

1 Answers1

1

This is the way you can send flash data from the backend:

public function show (){

//some code here

return redirect('/')->with('flash', 'message here');
}

and in the view you can display it like this:

{{session('flash')}} 

The above will display "message here".

If you have return redirect('/')->with('alert', 'something happened');

{{session('alert')}} 

The above will display "something happened".

GabMic
  • 1,422
  • 1
  • 20
  • 37