Posts Learn Components new Snippets new Categories Tags About
/

How to Prevent From Accidentally closing Laravel Nova Resource?

Learn how to prevent accidentally closing nova resources while creating or editing content

Created on Jul 07, 2021

29 views

To prevent accidentally closing the Laravel Nova resources page during creating or editing content, you have to set the "preventFormAbandonment" properties to true. By doing so, when any misclick that may lead to closing the page will be prevented and a confirmation form will be displayed.

/**
 * Indicates whether Nova should prevent the user from leaving an unsaved form, losing their data.
 *
 * @var bool
 */
public static $preventFormAbandonment = true;
new

If you like our tutorial, do make sure to support us with some coffee. We need the juice to write the content during the night 🤙🏻