I have a model defined in Laravel 5.1. For some reason, I can't seem to get the id from it:
Psy Shell v0.5.2 (PHP 5.6.13-0+deb8u1 — cli) by Justin Hileman
>>> $survey = \App\Survey::where('id',54)->get();
=> Illuminate\Database\Eloquent\Collection {#682
all: [
App\Survey {#693
id: 54,
created_at: "2015-10-12 03:18:32",
updated_at: "2015-10-12 03:18:32",
location_id: 0,
},
],
}
>>> echo $survey->id;
PHP error: Undefined property: Illuminate\Database\Eloquent\Collection::$id on line 1
>>>
What am I doing wrong?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire