TIP 07 / 09

Change API Token on Users Password Update.

It's convenient to change the user's API Token when its password changes.

Model:

code
protected function password(): Attribute
{
    return Attribute::make(
            set: function ($value, $attributes) {
                $value = $value;
                $attributes['api_token'] = Str::random(100);
            }
        );
}