SarahS's avatar
Level 12

Render()

I've been following a tutorial on setting up a simple Posts system and on the display page after the foreach() that shows all the Posts, it has this:

 {!! $posts->render() !!}

Looking into it it seems to be something to do with the pagination but I'd like to know exactly what this means?

0 likes
5 replies
Nakov's avatar
Nakov
Best Answer
Level 73

@sarahs74 it is better if you showed the tutorial along with the question, because it is hard to guess what it does.

I would assume that the post is stored in an HTML format, and then thats why it uses the {!! !!} which escapes the html tags.. which is not safe for the record.

$posts->links() would be more for the pagination, but render() is some type of a custom method on the Post model, or custom collection.

ahmeddabak's avatar

It is a user-defined method, without the source code no one will be able to tell what it does.

1 like
SarahS's avatar
Level 12

Yes thank you, I've been reading all that trying to figure out where the render() was. Another post mentions that it was used in old versions of Laravel (5.2?). I've swapped it to links() for now.

Please or to participate in this conversation.