本文整理匯總了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.");
}
});
}