本文整理汇总了PHP中app\Page::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::insert方法的具体用法?PHP Page::insert怎么用?PHP Page::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Page
的用法示例。
在下文中一共展示了Page::insert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insertBulk
public function insertBulk($chapter_id, $data)
{
foreach ($data as $key => $value) {
$data[$key]['chapter_id'] = $chapter_id;
$data[$key]['value'] = '';
}
// Create Page
$page = Page::insert($data);
// Passing data to response service
return $this->responseService->returnMessage($page, 'Page was not Inserted.');
}
示例2: 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.");
}
});
}