-
I saw this handy macro from a blogpost and I believe it will be a good addition to Laravel, for a significantly improved DX, especially when working with DB/Eloquent.
The above makes us go from this:
to this:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
I am somewhat unclear why I can only imagine two possible reasons for this: a. That there is some sort of perceived security risk by including the variable e.g. if the code was b. Either way, it seems to me that renaming The only other issue is if the example was used in a unit test, and tested against a string - in which case that test would then fail and this would be a breaking change. However surely you would want such tests to check that the binding had been substituted correctly anyway. |
Beta Was this translation helpful? Give feedback.
-
I can sort of understand why the bindings aren't included - with the above technique, the SQL string generated may not accurately represent what the database server will execute e.g.
would generate
which, if run, would provide very different results from the version that uses prepared statements. |
Beta Was this translation helpful? Give feedback.
-
Hey there, We're closing this issue because it's inactive, already solved, old, or not relevant anymore. Feel free to open up a new issue if you're still experiencing this problem. |
Beta Was this translation helpful? Give feedback.
-
This has been added to Laravel 10 via #47507 |
Beta Was this translation helpful? Give feedback.
This has been added to Laravel 10 via #47507