You should never allow this as it is a security risk. Raw PHP code should not go into the database. There is always a way to avoid this. Depends on what your goal is. {!! ... !!} is for raw html output and that too after sanitization or if you trust the content.
Feb 10, 2017
5
Level 4
Render php from string
Hello,
Is there a way to render php inside a string?
So I got an article from the controller, and in $article->content, it has php code in it, then on the view, I use {!! $article->content !!} to output the article content, but the php code in $article->content got commented out:
FROM: TO: <--?php $question = "example"; ?>
I am on 5.2
Level 4
But I found a solution:
http://robin.radic.nl/blade-extensions/blade-string.html
I can just render the php code before i output them
Please or to participate in this conversation.