I do make an update of one entry (eg. table data) in laravel 5.7.
In my Database/model/Data.php:
/**
* @var array
*/
public static $titleEntity = [
'id',
'title'
];
In my Controller
$data = Data::ofEntity('', Data::$titleEntity)
->where('id', $id)
->first();
$data->title = 'new title';
$data->save();
return json($data) //short version
the model has more attributes and I get back:
$data->title;
$data->text;
$data->update_time;
return json($data); //short version
I only want to return like my $titleEntity.
$data->title;
Why is my save/update function of laravel returning more entries not ony the $titleEntity?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire