本文整理汇总了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());
}
}
}
示例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();
}
示例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";
}
}
}
示例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);
}