Laravel 5 – Get the html code stored in the database

I insert some code into my database. When I open the database and copy the field which holds the code, it paste like the fllowing

So everything appears fine, just what I expect. Now in Laravel I need to get this code. So I do the following

$documentData = DocumentTemplate::where('name', $documentLink)->first(['form_data', 'form_data']);

And I pass this to my view. Within my view, I do the following

    Form::model(new AppDocument, [
        'route' => ['', $project->id],
        'files' => true

{!! $documentData !!}

{!! Form::label('filePath', 'Document:', array('class' => 'col-md-5 control-label green')) !!}
{!! Form::file('filePath[]', array('multiple'=>true)) !!}
{!! Form::close() !!}

When I check the output, it is a mess. If I view source, the HTML looks something like the following

n n
n n
n n
n n

So it appears to add backslashes all over the place, and things like n.

Why would this be happening?


because $documentData is object laravel transfer it to json.. you should do this:

{!! $documentData->form_data !!}
Hello, buddy!责编内容来自:Hello, buddy! (源链) | 更多关于

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 后端存储 » Laravel 5 – Get the html code stored in the database

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录