当前位置: 首页>>代码示例>>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;未经允许,请勿转载。