src/ErrorPage.php
protected function requireDefaultRecordFixture($defaultData)
    {
        $code = $defaultData['ErrorCode'];
        $page = ErrorPage::get()->filter('ErrorCode', $code)->first();
        $pageExists = !empty($page);
        if (!$pageExists) {
            $page = new ErrorPage($defaultData);
            $page->write();
            $page->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
        }

        // Check if static files are enabled
        if (!self::config()->enable_static_file) {
            return;
        }

        // Ensure this page has cached error content
        $success = true;
        if (!$page->hasStaticPage()) {
            // Update static content
            $success = $page->writeStaticPage();
        } elseif ($pageExists) {
            // If page exists and already has content, no alteration_message is displayed
            return;
        }

        if ($success) {
            DB::alteration_message(
                sprintf('%s error page created', $code),
                'created'
            );
        } else {
            DB::alteration_message(
                sprintf('%s error page could not be created. Please check permissions', $code),
                'error'
            );
        }
    }
protected function requireDefaultRecordFixture($defaultData)
    {
        $code = $defaultData['ErrorCode'];
        $page = ErrorPage::get()->filter('ErrorCode', $code)->first();
        $pageExists = !empty($page);
        if (!$pageExists) {
            $page = new ErrorPage($defaultData);
            $page->write();
            $page->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
        }

        // Check if static files are enabled
        if (!self::config()->enable_static_file) {
            return;
        }

        // Ensure this page has cached error content
        $success = true;
        if (!$page->hasStaticPage()) {
            // Update static content
            $success = $page->writeStaticPage();
        } elseif ($pageExists) {
            // If page exists and already has content, no alteration_message is displayed
            return;
        }

        if ($success) {
            DB::alteration_message(
                sprintf('%s error page created', $code),
                'created'
            );
        } else {
            DB::alteration_message(
                sprintf('%s error page could not be created. Please check permissions', $code),
                'error'
            );
        }
    }
protected function requireDefaultRecordFixture ( $ defaultData ) { $ code = $ defaultData [ 'ErrorCode' ] ; $ page = ErrorPage :: get ( ) -> filter ( 'ErrorCode' , $ code ) -> first ( ) ; $ pageExists = ! empty ( $ page ) ; if ( ! $ pageExists ) { $ page = new ErrorPage ( $ defaultData ) ; $ page -> write ( ) ; $ page -> copyVersionToStage ( Versioned :: DRAFT , Versioned :: LIVE ) ; } // Check if static files are enabled if ( ! self :: config ( ) -> enable_static_file ) { return ; } // Ensure this page has cached error content $ success = true ; if ( ! $ page -> hasStaticPage ( ) ) { // Update static content $ success = $ page -> writeStaticPage ( ) ; } elseif ( $ pageExists ) { // If page exists and already has content, no alteration_message is displayed return ; } if ( $ success ) { DB :: alteration_message ( sprintf ( '%s error page created' , $ code ) , 'created' ) ; } else { DB :: alteration_message ( sprintf ( '%s error page could not be created. Please check permissions' , $ code ) , 'error' ) ; } }
Build default record from specification fixture

@param array $defaultData
Build default record from specification fixture