As I title I trying to get data equal id
with ==
but its result empty array, did I miss a thing?...
➜ 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: [],
}
>>>
Just use a single one, =
. There is no such thing as ==
in laravel eloquent.