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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -