本文整理汇总了PHP中Period::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Period::create方法的具体用法?PHP Period::create怎么用?PHP Period::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Period
的用法示例。
在下文中一共展示了Period::create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
DB::table('periods')->delete();
Period::create(array('start' => '8:00', 'end' => '9:30', 'total' => 10, 'current' => 2, 'schedule_id' => 1));
Period::create(array('start' => '9:30', 'end' => '10:30', 'total' => 10, 'current' => 6, 'schedule_id' => 1));
Period::create(array('start' => '10:30', 'end' => '12:00', 'total' => 10, 'current' => 0, 'schedule_id' => 1));
Period::create(array('start' => '13:00', 'end' => '14:30', 'total' => 10, 'current' => 10, 'schedule_id' => 3));
Period::create(array('start' => '14:30', 'end' => '16:30', 'total' => 10, 'current' => 0, 'schedule_id' => 3));
Period::create(array('start' => '16:30', 'end' => '18:00', 'total' => 8, 'current' => 3, 'schedule_id' => 3));
}
示例2: insert_periods
protected function insert_periods()
{
$schedules = Schedule::all();
foreach ($schedules as $schedule) {
// 1/4几率将该schedule设为无号源
if (rand(0, 3)) {
if ($schedule->period == 0) {
Period::create(['start' => '8:00', 'end' => '9:30', 'total' => 10, 'current' => 0, 'schedule_id' => $schedule->id]);
} else {
if ($schedule->period == 1) {
Period::create(['start' => '14:00', 'end' => '15:30', 'total' => 10, 'current' => 0, 'schedule_id' => $schedule->id]);
}
}
}
}
}