laravel eloquent create vs insert
Updated: 17th July 2024
Tags: laravel
There are few important differences:
| # | Insert | Create |
|---|---|---|
| Respects fillable / guarded | No | Yes |
| Creates timestamps | No | Yes |
| Returns created object | No | Yes |
| Runs booted method (hooks, actions, observers) | No | Yes |
| Casts attributes to the format defined in the model (e.g., json column). | No | Yes |
| Allows multi insert | Yes | No |