How to prevent SQL injection in Laravel? -
in controller have code:
public function create($brand_id) { brand::findorfail($brand_id); }
and this:
public function search() { $q = input::get('q'); $brands = brand::where('title', 'like', '%'.$q.'%')->take(80)->get();
is code safe? "safe" mean sql injection safe. or should variable clean here? , best way cleaning user input? lot helping me :)
yes eloquent uses parameter behind behind scene, safely escapes input used in where().
Comments
Post a Comment