
User::where('foo', 10)->first(); select * from `users` where `foo` = 10 User::where('foo', '10')->first(); select * from `users` where `foo` = 10 User::where('foo', 'abc')->first(); select * from `users` where `foo` = 'abc' laravel5.8
1 iyaozhen 2019 年 12 月 19 日 via Android MySQL 里面试过吗?我记得不区分 10 还是'10' |
3 ylsc633 2019 年 12 月 19 日 恭喜你 遇到了一个 建立索引,且用了索引字段,但不走索引的情况! 以后可能会被问到! 哈哈哈 |
4 chinvo 2019 年 12 月 19 日 via iPhone 我记得 laravel 的 ORM 有个强制类型的参数,太就没用过有点记不清 |
5 zibber 2019 年 12 月 19 日 User::where('foo', Db:raw("'10'"))->first(); |