Search code examples
phpdatabaselaravellaravel-5summernote

How to display only latest post in laravel 5.2 and that too without html <p> tag?


I want to display only latest post(or status) posted by the user. The problem is all the posts are displayed with a <p> tag. I am taking input in summernote editor.

What I am doing is:

 $accounts=Account::orderBy('updated_at','')->get();

I am outputting it in my view file as : {{$account->estado}}


Solution

  • this will get latest account and limit to certain no as you want, for example get latest 5 post.

    $accounts=Account::orderBy('updated_at','desc')->limit(5)->get();