DEV Community

anditsung
anditsung

Posted on

3 2

override delete button on laravel nova crud

to override delete button on nova add this to model class

public function delete()
{
    $this->setKeysForSaveQuery($this->newModelQuery())->update(['active' => false]);
    return true;
}
Enter fullscreen mode Exit fullscreen mode

this will make delete button to update active field instead of delete it.

Top comments (1)

Collapse
 
jenueldev profile image
Jenuel Oras Ganawed

how about the update button?

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay