Laravel Eloquent 表中两列之间的位置

标签 laravel laravel-5 eloquent

Laravel 的 Eloquent 查询是什么:

select * from `jobs` where 1 between min_experience and max_experience;

我尝试了下面的查询,但这个查询用单引号封装了 where 1。

Job::whereRaw('? between min_experience and max_experience',1)->get();

select * from `jobs` where '1' between min_experience and max_experience;

最佳答案

这可能对你有用:

Job::where('min_experience', '<', 1)->where('max_experience', '>', 1)->get();

关于Laravel Eloquent 表中两列之间的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40624939/

相关文章:

json - 嵌套数组上的 Laravel AssertJsonCount

php - 如何获得 Laravel 关系中的第一行

laravel - vagrant/homestead up - 仅在家庭网络上连接超时

php - 使用 laravel 从多个表进行多个查询

php - Laravel5.0 : while passing variable in query function, 它显示 undefined variable

php - 我在这里使用什么 Laravel Eloquent 关系

php - 将两个模型合并为一个数据库调用 - laravel

php - 从 Laravel 中上传的文件中获取图像扩展名

laravel - 修改 Eloquent 模型的自定义属性

php - 找不到类 'Predis\Client' 循环