I have deleted created_at and updated_at from database but laravel tries to insert into these columns however I have deleted both from database and code in controller. I think something is cached. BTW I don't want to use public $timestamps = false in model because it seems they are extra and unneeded.
Well, in fact you need to set:
public $timestamps = false;
and it's not extra and unneeded because by default it's assumed models have timestamps (and in fact it's very reasonable to keep them almost in all tables).
Timestamps are used in process of saving record:
if ($this->usesTimestamps()) {
$this->updateTimestamps();
}
so there is no other shorter way when you are using Eloquent to set this property to false when you don't have those columns in table.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With