You don't need to escape it. This is one of the reasons those helper methods are there - to take care of safe value binding. You only need to worry about escaping when you execute query manually or use DB::raw() method.
Correct. If you ever get a DB Query exception in Laravel, you can generally see the escaping that the framework does for you.
There is also one very useful method to check the queries that actually have been run:
DB::getQueryLog()
When I want to know what was the real query, I do this immediately after running a query:
die(last(DB::getQueryLog())['query']);
If that wasn't the solution, I don't know if one exists. hahaha. Awesome little tidbit right there.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community