dimanche 2 juillet 2017

laravel how to properly esacpe inet_aton insertion?

so for example to save user ip into db:

$ip = Request::getClientIp();
...
$post->user_ip = DB::raw("inet_aton('$ip')");
$post->save()

I don't really like this code how to properly escape the $ip variable?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2udCqV0
via IFTTT

Aucun commentaire:

Enregistrer un commentaire