本文整理汇总了PHP中Domain::whereIn方法的典型用法代码示例。如果您正苦于以下问题:PHP Domain::whereIn方法的具体用法?PHP Domain::whereIn怎么用?PHP Domain::whereIn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Domain
的用法示例。
在下文中一共展示了Domain::whereIn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listUserDomains
public function listUserDomains()
{
$has_domains = count(Acl::getAdminEntitiesIDs('Domain'));
if (!empty($has_domains)) {
$user_domains = Domain::whereIn('id', Acl::getAdminEntitiesIDs('Domain'))->paginate(8);
return View::make('user.domains')->with(compact('user_domains'));
}
return View::make('user.account')->with('error', 'Nu ai nici un site inscris!');
}
示例2: die
<?php
include __DIR__ . '/../../start.php';
use Illuminate\Database\Capsule\Manager as DB;
$domains = Domain::whereRaw('`tf` is null AND `status` = "active"')->limit(getenv('DOMAINS_PER_MINUTE'))->get(['id', 'name'])->toArray();
if ($domains == 0) {
die('No domains!');
}
$domainIds = array_pluck($domains, 'id');
$chunks = array_chunk($domains, 100);
$sleepingTime = 55 / count($chunks);
$chunksAmount = count($chunks);
$domainsAmount = count($domains);
echo PHP_EOL . PHP_EOL . PHP_EOL . "Selected {$domainsAmount} domains" . PHP_EOL;
echo "Splitted into {$chunksAmount} chunks" . PHP_EOL;
echo "Threads will be launched with {$sleepingTime} second delay" . PHP_EOL . PHP_EOL;
echo 'Updated selected domains statuses to "busy"' . PHP_EOL . PHP_EOL . PHP_EOL;
Domain::whereIn('id', $domainIds)->update(['status' => 'busy']);
$threadN = 0;
foreach ($chunks as $chunk) {
$threadN++;
echo json_encode($chunk) . PHP_EOL;
echo "Launching thread #{$threadN}" . PHP_EOL;
exec(sprintf("php " . __DIR__ . "/worker.php '%s' > /dev/null &", json_encode($chunk)));
sleep($sleepingTime);
}
echo PHP_EOL . PHP_EOL . 'Finish' . PHP_EOL;