Reputation: 9977
On my laravel
project, I created the following record in sqlite
using php artisan tinker
.
App\Note {#642
id: "1",
card_id: "2",
body: "Some note for the card",
created_at: "2016-06-19 22:18:34",
updated_at: "2016-06-19 22:18:34",
}
How can I change the card_id
field to 1 instead of 2?
Upvotes: 0
Views: 458
Reputation: 2023
$note = App\Note::find(1);
$note->card_id = '1';
$note->save();
Upvotes: 1
Reputation: 4089
You can use Note
model to update the card_id
value.
$note = Note::find(1);
$note->update([
'card_id' => '1',
]);
Upvotes: 0