/** * Run the database seeds. * * @return void */ public function run() { $homepage = $this->create('Accueil', 'home', "Description de la page d'accueil", 1); $homepage->themepartials()->attach(Themepartial::all()); $this->attachMapWidget($homepage); }
/** * Attach default theme partials. * * @param Page $page * @param Template $template * * @return void */ protected function attachDefaultPartials(Page $page, Template $template) { $skeleton = Formatter::make($template->skeleton, Formatter::JSON); $xmlTemplate = @simplexml_load_string($skeleton->toXml(), 'SimpleXMLElement', LIBXML_NOWARNING); if ($xmlTemplate) { $partialsList = (string) $xmlTemplate->attributes->partials; if ($partialsList) { $partials = explode(',', $partialsList); foreach ($partials as $partial) { $partialModel = Themepartial::whereName($partial)->first(); if ($partialModel) { $page->themepartials()->attach($partialModel); } } } } }
protected function isThemePartial($partial) { return Themepartial::whereName($partial)->first(); }
protected function attachPaymentCancelledWidgets($paymentCancelled) { $paymentCancelled->themepartials()->attach(Themepartial::all()); $config = ['type' => 'code', 'content' => '<div class="panel panel-default">' . PHP_EOL . ' <div class="panel-body">' . PHP_EOL . ' <h1>' . trans('frontend.payment.error.title') . '</h1>' . PHP_EOL . ' <br /><br />' . PHP_EOL . ' <p>' . trans('frontend.payment.error.content') . '</p>' . PHP_EOL . ' </div>' . PHP_EOL . '</div>']; $this->attachWidget($paymentCancelled, 'content', 'ZEDx', 'Editor', $config); }
/** * Save theme partials. * * @return void */ public function saveThemePartials() { $ids = []; $manifest = $this->getManifest(); $partials = isset($manifest['partials']) ? $manifest['partials'] : []; foreach ($partials as $partial) { $ids[] = Themepartial::firstOrCreate(['name' => $partial['file'], 'title' => $partial['title']])->id; } $partialsToRemove = Themepartial::whereNotIn('id', $ids)->get(); foreach ($partialsToRemove as $partial) { $partial->delete(); } }