After some actions inside of my Laravel 6 app, I'm trying to update my model object $last
(class CurrentConditions). As you can see below, I'm trying to update update_time
property to current timestamp. Except this property, I have another timestamp property inside the CurrentConditions model: external_update_time
and I want this property to stay the same after updating and saving $last
object. Problem is that external_update_time
property is updated to current time after saving the model.
/** @var CurrentConditions $last */
$last = $this->getLastUpdatedCurrentConditions($cityID);
$last->update_time = Carbon::now("UTC");
$last->save();
Here is my model:
class CurrentConditions extends Model
{
protected $table = 'current_conditions';
...
public $timestamps = false;
protected $dates = ['update_time', 'external_update_time'];
...
}
And here is my migration code:
Schema::create("current_conditions", function (Blueprint $table) {
$table->bigIncrements("current_conditions_id");
...
$table->timestamp("external_update_time");
$table->timestamp("update_time")->useCurrent();
});
So why is external_update_time
updating as well? Thanks for any help.