mardi 3 novembre 2015

laravel mysql ignore letters after number

I'm using Laravel 5.1 . I made my route rule. "/post/{id}" and post will return with this code.

Post::find($id);

Yeah! It works.

But I just wondered whether it works with non-numeric or not. (ex : 1dssadf) So I motified the code.

Post::find('1dssadf');

(There is a post id 1)

I excepted error. But It works. it found a post id 1. (ignored dssadf)

Why '1dssadf' treated as '1'?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire