本文整理汇总了PHP中Period::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Period::all方法的具体用法?PHP Period::all怎么用?PHP Period::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Period
的用法示例。
在下文中一共展示了Period::all方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postData
/**
* [postData - handle company specific posted data]
* @return [json] [DT compatible object]
*/
public function postData()
{
$Model = $this->modelName;
// Build our Editor instance and process the data coming from _POST
global $db;
$data = Editor::inst($db, 'services')->fields(Field::inst('services.id'), Field::inst('services.name'), Field::inst('services.category_id'), Field::inst('service_categories.name'), Field::inst('services.invoice_periods_id'), Field::inst('invoice_periods.description'), Field::inst('services.status_id'), Field::inst('statuses.description'), Field::inst('services.default_monthly_costs'), Field::inst('services.comment'))->leftJoin('service_categories', 'service_categories.id', '=', 'services.category_id')->leftJoin('statuses', 'statuses.id', '=', 'services.status_id')->leftJoin('invoice_periods', 'invoice_periods.id', '=', 'services.invoice_periods_id')->process($_POST)->data();
$data['service_categories'] = ServiceCategory::all(['id AS value', 'name AS label']);
$data['statuses'] = Status::all(['id AS value', 'description AS label']);
$data['invoice_periods'] = Period::all(['id AS value', 'description AS label']);
return Response::json($data);
}
示例2: insert_records
public function insert_records()
{
$periods = Period::all();
$accounts = RegisterAccount::all();
$peirod_num = $periods->count();
$account_num = $accounts->count();
for ($i = 0; $i < 2000; ++$i) {
$record = new RegisterRecord();
$account = $accounts[rand(0, $account_num - 1)];
$period = $periods[rand(0, $peirod_num - 1)];
$dt = rand(0, 99) < 90 ? $this->get_random_datetime() : date('Y-m-d H:i:s');
$record->created_at = $dt;
$record->start = date('Y-m-d H:i:s', strtotime($dt) + 3600);
if (rand(0, 1)) {
$record->return_date = $this->get_random_date();
}
$record->status = rand(0, 1);
$record->fee = 1.0;
if (rand(0, 1)) {
$record->advice = "abcd1234";
}
$record->account_id = $account->id;
$record->user_id = $account->user_id;
$record->period_id = $period->id;
$record->doctor_id = $period->schedule->doctor_id;
$period->current += 1;
$period->save();
$record->save();
$message = new Message();
$message->from_uid = $record->user_id;
$message->to_uid = $record->doctor->user->id;
$message->content = $record->user->real_name . '挂号';
$message->timestamp = strtotime($dt);
$message->status = 3;
$message->save();
}
}
示例3: postModelData
/**
* [postModelData - handle company specific posted subscriptions data]
* @param [Eloquent model] $model [company model]
* @return [json] [DT compatible object]
*/
public function postModelData($model)
{
$Model = $this->modelName;
if (isset($_POST["data"]) && !empty($_POST["data"])) {
$tot_price_str = $_POST['data']['subscriptions']['total_price'];
if (empty($tot_price_str)) {
$subs_id = (int) $_POST['data']['subscriptions']['id'];
$subscription = Subscription::find($subs_id);
$tot_price_str = $this->subscriptionTotalPrice($_POST['data']['subscriptions']['subscription_start'], $_POST['data']['subscriptions']['subscription_end'], $_POST['data']['subscriptions']['invoice_periods_id'], $_POST['data']['subscriptions']['price']);
$_POST['data']['subscriptions']['total_price'] = $tot_price_str;
}
//error_log("Le POST".json_encode($_POST['data']['subscriptions']['total_price']));
}
// Build our Editor instance and process the data coming from _POST
global $db;
$data = Editor::inst($db, 'subscriptions')->fields(Field::inst('subscriptions.id'), Field::inst('subscriptions.company_id'), Field::inst('service_categories.id'), Field::inst('service_categories.name'), Field::inst('subscriptions.service_id'), Field::inst('services.name'), Field::inst('subscriptions.description'), Field::inst('subscriptions.price'), Field::inst('subscriptions.total_price'), Field::inst('subscriptions.subscription_start'), Field::inst('subscriptions.subscription_end')->validator(function ($val, $data, $opts) {
$date_start = strtotime($data['subscriptions']['subscription_start']);
$date_end = strtotime($data['subscriptions']['subscription_end']);
return $date_end > $date_start ? true : "Error: End date precedes start date";
}), Field::inst('subscriptions.invoice_id'), Field::inst('subscriptions.invoice_periods_id'), Field::inst('invoice_periods.description'), Field::inst('subscriptions.status_id'), Field::inst('statuses.description'), Field::inst('subscriptions.status_date'))->leftJoin('invoice_periods', 'invoice_periods.id', '=', 'subscriptions.invoice_periods_id')->leftJoin('statuses', 'statuses.id', '=', 'subscriptions.status_id')->leftJoin('companies', 'companies.id', '=', 'subscriptions.company_id')->leftJoin('services', 'services.id', '=', 'subscriptions.service_id')->leftJoin('service_categories', 'service_categories.id', '=', 'services.category_id')->process($_POST)->data();
$data['companies'] = Company::all(['id AS value', 'bedrijfsnaam AS label']);
$data['services'] = Service::all(['id AS value', 'name AS label']);
$data['service_categories'] = ServiceCategory::all(['id AS value', 'name AS label']);
$data['statuses'] = Status::all(['id AS value', 'description AS label']);
$data['invoice_periods'] = Period::all(['id AS value', 'description AS label']);
return Response::json($data);
}