Jaymin
Jaymin

Reputation: 1661

Yajra Datatables single quote parsing

I am using Yajra Datatable to create Apis in Laravel.

I have string called blog's where while fetching from database it gives me ' in response. I want to convert and return in proper apostrophe format only.

I tried following ways and both worked proper in php but I think it might be issue with Yajra Datatable.

Can Someone help me out.

I've tried following ways and both worked fine in normal php.

return mb_convert_encoding($data->blog_title, "UTF-8", "HTML-ENTITIES");

return str_replace("'","'",$data->blog_title);

Thanks

Upvotes: 0

Views: 395

Answers (1)

Jaymin
Jaymin

Reputation: 1661

After a bit of R&D it was somewhere mentioned in Yajra Datatable documentation, written not clearly. So if someone wants to escape the string and return it in original format, they have escape function.

This is how it can be used.

$list = Datatables::of($Blog)
                ->escapeColumns('blog_title')

It will return data with apostrope s.

Upvotes: 2

Related Questions