Every time I perform the following:
$user = new User;
$user->name = 'John';
$user->save();
I want a field called "modified" to be updated to NOW()
in MySQL. I can't use Laravel's timestamps because I'm only using a single modified field. I could rely on MySQL to do this for me, but I was wondering if there was a way to accomplish this in my Laravel model? Perhaps using a mutator in some way to set this before saving?
As a bonus: how would I do something like this $user->modified = "NOW()"
? (which is obviously wrong, but hopefully demonstrates the point)