正如我的标题,我试图用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雄辩中没有==
这样的东西。
你需要使用单个'='。 close中使用的比较规则是mysql而不是php。