当前位置: 首页>>代码示例>>PHP>>正文


PHP Page::truncate方法代码示例

本文整理汇总了PHP中app\Page::truncate方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::truncate方法的具体用法?PHP Page::truncate怎么用?PHP Page::truncate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Page的用法示例。


在下文中一共展示了Page::truncate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: importInfinityBoardPages

 /**
  * 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.");
         }
     });
 }
开发者ID:LulzNews,项目名称:infinity-next,代码行数:28,代码来源:Import.php

示例2: run

 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]]);
 }
开发者ID:arthurolg,项目名称:blog,代码行数:5,代码来源:DatabaseSeeder.php

示例3: run

 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)]);
     }
 }
开发者ID:Erbenos,项目名称:laravel-blog,代码行数:9,代码来源:DatabaseSeeder.php

示例4: run

 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]);
                 }
             }
         }
     }
 }
开发者ID:schel4ok,项目名称:steklo,代码行数:69,代码来源:XLSSeeder.php


注:本文中的app\Page::truncate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。