[英]Laravel Greater than or equal in views
I passed a variable to view and I want to make an if condition for this value with greater than or equal我传递了一个变量来查看,我想为这个值设置一个大于或等于的 if 条件
example例子
@if($var >= 3)
do something...
@endif
when I do this I got this error当我这样做时,我收到了这个错误
Object of class Illuminate\\Database\\Eloquent\\Collection could not be converted to int
类 Illuminate\\Database\\Eloquent\\Collection 的对象无法转换为 int
I search a lot about this but I didn't get any answers我搜索了很多关于这个但我没有得到任何答案
Assuming you want to compare the number of records.假设您要比较记录数。 Then you can achieve the same as below
然后你可以实现与下面相同的
if ($var->count() >= 3){ }
if (count($var) >= 3) {}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.