I wanna check if the data has been deletes. So i use eloquent like:
$check = ModelName::withTrashed()->where("id","=",$id)
->select("id","deleted_at","other_field")
->get();
foreach ($check as $rw) {
echo $rw->id; // it print the id
echo $rw->other_field; //also print the field value
echo $rw->deleted_at; // Error:
//InvalidArgumentException in Carbon.php line 425:
//Data missing
//at Carbon::createFromFormat('Y-m-d H:i:s.000', '2016-09-19 07:06:56') in Model.php line 2955
}
Then i try to dump to see the value:
dd($check);
The result of deleted_at echo it value like:
#attributes: array:3 [▼
"id" => 1
"deleted_at" => "2016-09-19 07:06:56"
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire