Mutate Before Create Function

    protected function mutateFormDataBeforeCreate(array $data): array
    {
        $data['date_issued'] = date(now());
        return $data;
        $amount = $data['stock_issued'];
        $stock = 10;
        if ($amount > $stock) {
            Notification::make()
                ->warning()
                ->title('You don\'t have enough Stock!!!')
                ->body('Only ' . $stock . ' in inventory.')
                ->send();
            $this->halt();
        }
    }


Can anyone please tell me what's wrong here, I don't get any errors but it doesn't work, and I tried to use the beforeCreate() Function but that doesn't let me pass the $data array.
Solution
What's not working? Can you be more specific? You have return on second line so everything later won't be executed
Was this page helpful?