Posts Learn Snippets 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

6 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;

Created by

PostSrc poster

PostSrc

Full stack developer mainly focusing on the front end side of the web. The main author of PostSrc and loves writing tutorial and guides online.