/** * Imports board pages. * * @return void */ public function importInfinityBoardPages() { $this->info("\tImporting board pages ..."); Page::truncate(); Board::orderBy('board_uri', 'asc')->chunk(1, function ($boards) { foreach ($boards as $board) { $this->line("\t\tImporting pages from /{$board->board_uri}/"); $tPages = $this->tcon->table("pages")->where('board', $board->board_uri)->get(); $pagesMade = 0; $pages = []; $now = Carbon::now(); foreach ($tPages as $tPage) { if (!$tPage->content) { continue; } $pages[] = ['created_at' => $now, 'updated_at' => $now, 'board_uri' => $board->board_uri, 'name' => $tPage->name, 'title' => $tPage->title, 'body' => $tPage->content]; ++$pagesMade; } Page::insert($pages); $this->line("\t\tCreated {$pagesMade} pages."); } }); }
public function run() { Page::truncate(); DB::table('pages')->insert([['title' => 'About', 'uri' => 'about', 'content' => 'Es la pagina de about', 'parent_id' => null, 'lft' => 3, 'rgt' => 8, 'depth' => 0], ['title' => 'Contact', 'uri' => 'contact', 'content' => 'Es la pagina de contact', 'parent_id' => 1, 'lft' => 4, 'rgt' => 5, 'depth' => 1], ['title' => 'FAQ', 'uri' => 'faq', 'content' => 'Es la pagina de faq', 'parent_id' => 1, 'lft' => 6, 'rgt' => 7, 'depth' => 1], ['title' => 'Media', 'uri' => 'media', 'content' => 'Es la pagina de media', 'parent_id' => null, 'lft' => 1, 'rgt' => 2, 'depth' => 0], ['title' => 'Characters', 'uri' => 'chars', 'content' => 'Es la pagina de chars', 'parent_id' => null, 'lft' => 9, 'rgt' => 10, 'depth' => 0]]); }
public function run() { $faker = Faker\Factory::create(); Page::truncate(); foreach (range(1, 5) as $index) { $name = ucfirst($faker->unique()->word()); Page::create(['name' => $name, 'slug' => str_slug($name), 'content' => $faker->text(700)]); } }
public function run() { $xls = 'database/seeds/seeder.xlsm'; $book = Excel::load($xls, 'UTF-8')->all(); foreach ($book as $sheet) { if ($sheet->getTitle() === 'categories') { Category::truncate(); foreach ($sheet as $row) { $category = Category::create(['id' => $row->id, 'parent_id' => $row->parent_id, 'level' => $row->level, 'type' => $row->type, 'menutype' => $row->menutype, 'title' => $row->title, 'sef' => $row->sef, 'class' => $row->class, 'body' => $row->body, 'image' => $row->image, 'metatitle' => $row->metatitle, 'metakey' => $row->metakey, 'metadesc' => $row->metadesc]); } } if ($sheet->getTitle() === 'furnitura') { Furnitura::truncate(); foreach ($sheet as $row) { if (!empty($row->category_id)) { $menu = Furnitura::create(['id' => $row->id, 'category_id' => $row->category_id, 'cat2_id' => $row->cat2_id, 'title' => $row->title, 'sef' => $row->sef, 'introtext' => $row->introtext, 'fulltext' => $row->fulltext, 'artikul' => $row->artikul, 'otdelka' => $row->otdelka, 'pcs' => $row->pcs, 'description' => $row->description, 'metatitle' => $row->metatitle, 'metakey' => $row->metakey, 'metadesc' => $row->metadesc, 'hits' => $row->hits]); } } } if ($sheet->getTitle() === 'links') { Link::truncate(); foreach ($sheet as $row) { if (!empty($row->category_id)) { $menu = Link::create(['category_id' => $row->category_id, 'title' => $row->title, 'url' => $row->url, 'description' => $row->description, 'version' => $row->version, 'metatitle' => $row->metatitle, 'metakey' => $row->metakey, 'metadesc' => $row->metadesc, 'hits' => $row->hits]); } } } if ($sheet->getTitle() === 'news') { News::truncate(); foreach ($sheet as $row) { if (!empty($row->category_id)) { $menu = News::create(['category_id' => $row->category_id, 'title' => $row->title, 'sef' => $row->sef, 'introtext' => $row->introtext, 'fulltext' => $row->fulltext, 'image' => $row->image, 'metatitle' => $row->metatitle, 'metakey' => $row->metakey, 'metadesc' => $row->metadesc, 'hits' => $row->hits, 'created_at' => $row->created_at]); } } } if ($sheet->getTitle() === 'steklo') { Page::truncate(); foreach ($sheet as $row) { if (!empty($row->category_id)) { $menu = Page::create(['category_id' => $row->category_id, 'title' => $row->title, 'sef' => $row->sef, 'introtext' => $row->introtext, 'fulltext' => $row->fulltext, 'image' => $row->image, 'metatitle' => $row->metatitle, 'metakey' => $row->metakey, 'metadesc' => $row->metadesc, 'hits' => $row->hits]); } } } if ($sheet->getTitle() === 'uslugi') { Uslugi::truncate(); foreach ($sheet as $row) { if (!empty($row->category_id)) { $menu = Uslugi::create(['category_id' => $row->category_id, 'title' => $row->title, 'sef' => $row->sef, 'introtext' => $row->introtext, 'fulltext' => $row->fulltext, 'image' => $row->image, 'metatitle' => $row->metatitle, 'metakey' => $row->metakey, 'metadesc' => $row->metadesc, 'hits' => $row->hits]); } } } if ($sheet->getTitle() === 'faq') { Faq::truncate(); foreach ($sheet as $row) { if (!empty($row->category_id)) { $menu = Faq::create(['category_id' => $row->category_id, 'title' => $row->title, 'sef' => $row->sef, 'introtext' => $row->introtext, 'fulltext' => $row->fulltext, 'image' => $row->image, 'metatitle' => $row->metatitle, 'metakey' => $row->metakey, 'metadesc' => $row->metadesc, 'hits' => $row->hits]); } } } if ($sheet->getTitle() === 'objects') { Object::truncate(); foreach ($sheet as $row) { if (!empty($row->category_id)) { $menu = Object::create(['category_id' => $row->category_id, 'title' => $row->title, 'sef' => $row->sef, 'introtext' => $row->introtext, 'fulltext' => $row->fulltext, 'image' => $row->image, 'metatitle' => $row->metatitle, 'metakey' => $row->metakey, 'metadesc' => $row->metadesc, 'hits' => $row->hits]); } } } } }