'Laravel can't change attribute model value on retrieved with observer

I try to change the value oh my model value on retrieve observer;

My table has this column 'hour_start' and his value is like '2022-05-12 10:00'.

In my observer class I have

public function retrieved(Opportunitie $opportunitie)
{
    $opportunitie->hour_start = Carbon::parse($opportunitie->hour_start)->format('H:i');
    $opportunitie->hour_end = Carbon::parse($opportunitie->hour_end)->format('H:i');

    // dd($opportunitie->hour_start);
}

in my controller

public function index()
    {
        $opportunities = $this->service->list();
        dd(Opportunitie::first());
        return view('dashboard.view.opportunity.index', compact('opportunities'));
    }

When I set dd on the last line of my observer function, I got '10:00' as expected but on my controller I always get the full value '2022-05-12 10:00'

I already set the configuration on my EventServiceProvider in the boot function

Opportunitie::observe(OpportunitieObserver::class);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source