當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Board::all方法代碼示例

本文整理匯總了PHP中app\Board::all方法的典型用法代碼示例。如果您正苦於以下問題:PHP Board::all方法的具體用法?PHP Board::all怎麽用?PHP Board::all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Board的用法示例。


在下文中一共展示了Board::all方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $firstPost = Post::orderBy('post_id', 'asc')->first()->pluck('created_at');
     $trackTime = clone $firstPost;
     $nowTime = Carbon::now()->minute(0)->second(0)->timestamp;
     $boards = Board::all();
     $this->comment("Reviewing all records.");
     while ($firstPost->timestamp < $nowTime) {
         $firstPost = $firstPost->addHour();
         $hourCount = 0;
         foreach ($boards as $board) {
             if ($board->posts_total > 0) {
                 $newRows = $board->createStatsSnapshot($firstPost);
                 $hourCount += count($newRows);
             }
         }
         if ($hourCount > 0) {
             $this->comment("\tAdded {$hourCount} new stat row(s) from " . $firstPost->diffForHumans());
         }
     }
 }
開發者ID:JEWSbreaking8chan,項目名稱:infinity-next,代碼行數:26,代碼來源:RecordStatsAll.php

示例2: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $firstPost = Post::orderBy('post_id', 'asc')->first()->pluck('created_at');
     $nowTime = Carbon::now()->minute(0)->second(0)->timestamp;
     $boards = Board::all();
     $this->comment("Reviewing all records.");
     while ($firstPost->timestamp < $nowTime) {
         $firstPost = $firstPost->addHour();
         $hourCount = 0;
         foreach ($boards as $board) {
             if ($board->posts_total > 0) {
                 $newRows = $board->createStatsSnapshot($firstPost);
                 $hourCount += $newRows->count();
             }
         }
         if ($hourCount > 0) {
             $this->comment("\tAdded {$hourCount} new stat row(s) from " . $firstPost->diffForHumans());
         }
     }
     // Drop boardlist cache.
     Cache::forget('site.boardlist');
     // Generate boardlist again.
     Board::getBoardsForBoardlist();
 }
開發者ID:LulzNews,項目名稱:infinity-next,代碼行數:29,代碼來源:RecordStatsAll.php

示例3: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::dropIfExists('stats_uniques');
     Schema::dropIfExists('stats');
     Schema::create('stats', function (Blueprint $table) {
         $table->bigIncrements('stats_id');
         $table->string('board_uri', 32);
         $table->timestamp('stats_time');
         $table->string('stats_type', 25);
         $table->bigInteger('counter')->unsigned()->default(0);
         $table->unique(['stats_time', 'board_uri', 'stats_type']);
     });
     Schema::create('stats_uniques', function (Blueprint $table) {
         $table->bigIncrements('stats_bit_id');
         $table->bigInteger('stats_id')->unsigned();
         $table->bigInteger('unique');
         $table->foreign('stats_id')->references('stats_id')->on('stats')->onDelete('cascade')->onUpdate('cascade');
     });
     $firstPost = Post::orderBy('post_id', 'asc')->first()->pluck('created_at');
     $trackTime = clone $firstPost;
     $nowTime = \Carbon\Carbon::now()->minute(0)->second(0)->timestamp;
     $boards = Board::all();
     while ($firstPost->timestamp < $nowTime) {
         $firstPost = $firstPost->addHour();
         $hourCount = 0;
         foreach ($boards as $board) {
             if ($board->posts_total > 0) {
                 $newRows = $board->createStatsSnapshot($firstPost);
                 $hourCount += count($newRows);
             }
         }
         if ($hourCount > 0) {
             echo "\tAdded {$hourCount} new stat row(s) from " . $firstPost->diffForHumans() . "\n";
         }
     }
 }
開發者ID:LulzNews,項目名稱:infinity-next,代碼行數:41,代碼來源:2015_10_14_120643_create_stats_tables.php

示例4: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $boards = Board::all();
     return \Response::json(['data' => $boards->toArray()], 200);
 }
開發者ID:kylerdanielster,項目名稱:Mello,代碼行數:10,代碼來源:BoardController.php


注:本文中的app\Board::all方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。