为什么 php == 不在 artisan tinker laravel 上工作

why php == not working on artisan tinker laravel

正如我的标题,我试图用 == 获取数据 equal id 但它的结果是空数组,我错过了什么吗?...

➜  page php artisan tinker
Psy Shell v0.9.8 (PHP 7.1.16 — cli) by Justin Hileman
>>> $page = App\PageAtribut::where('page_id', '<', 2)->get()
=> Illuminate\Database\Eloquent\Collection {#2858
     all: [
       App\PageAtribut {#2844
         id: 1,
         page_id: 1,
         watchable_id: 1,
         watchable_type: "App\Category",
         created_at: "2018-09-11 11:03:20",
         updated_at: "2018-09-11 11:03:20",
       },
       App\PageAtribut {#2861
         id: 2,
         page_id: 1,
         watchable_id: 2,
         watchable_type: "App\User",
         created_at: "2018-09-11 11:03:40",
         updated_at: "2018-09-11 11:03:40",
       },
     ],
   }
>>> $page = App\PageAtribut::where('page_id', '==', 1)->get()
=> Illuminate\Database\Eloquent\Collection {#2846
     all: [],
   }
>>>

只用一个,=。 laravel eloquent.

中没有==

您需要使用单个“=”。 where close 中使用的比较规则是 mysql 而不是 php 的比较规则。