本文整理汇总了PHP中Branch::getBranchesByBusinessId方法的典型用法代码示例。如果您正苦于以下问题:PHP Branch::getBranchesByBusinessId方法的具体用法?PHP Branch::getBranchesByBusinessId怎么用?PHP Branch::getBranchesByBusinessId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Branch
的用法示例。
在下文中一共展示了Branch::getBranchesByBusinessId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postRemove
public function postRemove()
{
$post = json_decode(file_get_contents("php://input"));
if (Helper::isBusinessOwner($post->business_id, Helper::userId())) {
// PAG added permission checking
Business::deleteBusinessByBusinessId($post->business_id);
$branches = Branch::getBranchesByBusinessId($post->business_id);
foreach ($branches as $count => $data) {
$services = Service::getServicesByBranchId($data->branch_id);
foreach ($services as $count2 => $data2) {
$terminals = Terminal::getTerminalsByServiceId($data2->service_id);
foreach ($terminals as $count3 => $data3) {
TerminalUser::deleteUserByTerminalId($data3['terminal_id']);
}
Terminal::deleteTerminalsByServiceId($data2->service_id);
}
Service::deleteServicesByBranchId($data->branch_id);
}
Branch::deleteBranchesByBusinessId($post->business_id);
UserBusiness::deleteUserByBusinessId($post->business_id);
return json_encode(array('status' => 1));
} else {
return json_encode(array('status' => 0, 'message' => 'You are not allowed to access this function.'));
}
}
示例2: getActiveBusiness
/**
* @author Ruffy
* @return JSON response containing list of active businesses
*/
public function getActiveBusiness()
{
$active_businesses = array();
$businesses = Business::all();
foreach ($businesses as $count => $business) {
$branches = Branch::getBranchesByBusinessId($business->business_id);
foreach ($branches as $count2 => $branch) {
$services = Service::getServicesByBranchId($branch->branch_id);
foreach ($services as $count3 => $service) {
$priority_numbers = PriorityNumber::getTrackIdByServiceId($service->service_id);
foreach ($priority_numbers as $count4 => $priority_number) {
$priority_queues = PriorityQueue::getTransactionNumberByTrackId($priority_number->track_id);
foreach ($priority_queues as $count5 => $priority_queue) {
$terminal_transactions = TerminalTransaction::getTimesByTransactionNumber($priority_queue->transaction_number);
foreach ($terminal_transactions as $count6 => $terminal_transaction) {
$grace_period = time() - $terminal_transaction->time_queued;
// issued time must be on the current day to count as active
if ($terminal_transaction->time_queued != 0 && $terminal_transaction->time_completed == 0 && $terminal_transaction->time_removed == 0 && $grace_period < 86400) {
// 1 day; 60secs * 60 min * 24 hours
$active_businesses[] = array('business_id' => $business->business_id, 'local_address' => $business->local_address, 'name' => $business->name);
$actives = array('active-business' => $active_businesses);
break;
}
}
if (array_key_exists($business->business_id, $active_businesses)) {
break;
}
}
if (array_key_exists($business->business_id, $active_businesses)) {
break;
}
}
if (array_key_exists($business->business_id, $active_businesses)) {
break;
}
}
if (array_key_exists($business->business_id, $active_businesses)) {
break;
}
}
}
return Response::json($actives, 200, array(), JSON_PRETTY_PRINT);
}