Route::get('/update', function(){ Post::where('id', 3)->update(['title'=>'new php title','content'=>'I found it']); });
mysql> select * from posts;
+—-+——————-+——————————————————+———————+———————+———-+
| id | title | content | created_at | updated_at | is_admin |
+—-+——————-+——————————————————+———————+———————+———-+
| 1 | Update tile | Laravel is the best thing that happen to PHP | NULL | NULL | 0 |
| 3 | laravel awesome | Laravel is the best thing that happen to PHP, period | NULL | NULL | 0 |
| 4 | new ORM title 2 | wow eloquent is really cool, look at this content | 2019-12-05 18:23:33 | 2019-12-05 18:33:31 | 0 |
| 5 | php create method | Wow I’m learning a lot | 2019-12-05 18:47:53 | 2019-12-05 18:47:53 | 0 |
+—-+——————-+——————————————————+———————+———————+———-+
4 rows in set (0.00 sec)
Route::get('/delete', function(){ $post = Post::find(5); $post->delete(); });
Route::get('/delete2', function(){ Post::destroy(3); });
あ、何故deleteではなくdestroyの名称が使われているかわかりました。