I have the status attribute in my class. When creating a new instance, using 'create', I pass an array to the status.
class email extends Eloquent{
protected $table = 'emails';
protected $fillable = array(
'status',
);
}
And this is the result
"status": {
"sent": false,
"deleted": false,
"silent": false
}
I'm trying to do this to update only one of the statuses.
$dest= email::where('uid', "5040")->update(['status.sent'=>true]);
But this produces a result I would not like.
"status": {
"sent": true
}
All previously written content has been deleted, how to get this result.
"status": {
"sent": true,
"deleted": false,
"silent": false
}
I have an idea of querying the bank and getting the status array, storing it, changing it, and updating it, but that would make me query the bank twice. One fetching the array, the other updating. There is a way, like 'spread'(...). Or something more correct and simple.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire