当前位置: 首页>>代码示例>>PHP>>正文


PHP Carbon::yesterday方法代码示例

本文整理汇总了PHP中Carbon\Carbon::yesterday方法的典型用法代码示例。如果您正苦于以下问题:PHP Carbon::yesterday方法的具体用法?PHP Carbon::yesterday怎么用?PHP Carbon::yesterday使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Carbon\Carbon的用法示例。


在下文中一共展示了Carbon::yesterday方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: schedule

 /**
  * Define the application's command schedule.
  *
  * @param  \Illuminate\Console\Scheduling\Schedule $schedule
  *
  * @return void
  */
 protected function schedule(Schedule $schedule)
 {
     $schedule->command('inspire')->hourly();
     // 进入维护模式
     $schedule->command('down')->evenInMaintenanceMode()->dailyAt('23:00');
     //->when(function () {return true;});//
     // 更新用户等级
     $schedule->call(function () {
         $registrations = Registration::where('state', 0)->where(function ($query) {
             $query->where('registration_date', Carbon::yesterday()->toDateString());
         })->get();
         foreach ($registrations as $registration) {
             $user = $registration->user;
             $user->credit_level -= 1;
             $user->save();
         }
     })->evenInMaintenanceMode()->daily();
     //
     // 重置rest_num
     $schedule->call(function () {
         $doctor_schedules = DocSchedule::where('state', 0)->where(function ($query) {
             $week = [1 => 'monday', 2 => 'tuesday', 3 => 'wednesday', 4 => 'thursday', 5 => 'friday', 6 => 'saturday', 7 => 'sunday'];
             $query->where('doctoring_date', $week[Carbon::today()->dayOfWeek]);
         })->get();
         foreach ($doctor_schedules as $doctor_schedule) {
             $doctor_schedule->rest_num = $doctor_schedule->total_num;
             $doctor_schedule->save();
         }
     })->evenInMaintenanceMode()->dailyAt('3:00');
     //
     // 离开维护模式
     $schedule->command('up')->evenInMaintenanceMode()->dailyAt('7:00');
     //
 }
开发者ID:Beyond-Game,项目名称:Raffaello,代码行数:41,代码来源:Kernel.php

示例2: conferences_dont_accept_proposals_outside_of_the_call_for_papers

 /** @test */
 public function conferences_dont_accept_proposals_outside_of_the_call_for_papers()
 {
     $conference = Factory::create('conference', ['cfp_starts_at' => Carbon::tomorrow(), 'cfp_ends_at' => Carbon::tomorrow()->addDay()]);
     $this->assertFalse($conference->isCurrentlyAcceptingProposals());
     $conference = Factory::create('conference', ['cfp_starts_at' => Carbon::yesterday()->subDay(), 'cfp_ends_at' => Carbon::yesterday()]);
     $this->assertFalse($conference->isCurrentlyAcceptingProposals());
 }
开发者ID:jwalton512,项目名称:symposium,代码行数:8,代码来源:ConferenceTest.php

示例3: getDateRange

 /**
  * @return array
  */
 private function getDateRange()
 {
     if (is_array($this->dateRange)) {
         return $this->dateRange;
     }
     switch (strtolower($this->dateRange)) {
         case 'today':
             return [$this->carbon->today(), $this->carbon->tomorrow()];
         case 'yesterday':
             return [$this->carbon->yesterday(), $this->carbon->today()];
         case 'thisweek':
             return [$this->carbon->today()->dayOfWeek === 0 ? $this->carbon->today() : $this->carbon->today()->previous(0), $this->carbon->tomorrow()];
         case 'lastweek':
             return [$this->carbon->today()->dayOfWeek === 0 ? $this->carbon->today()->previous(0) : $this->carbon->today()->previous(0)->previous(), $this->carbon->today()->previous(6)->addDay()];
         case 'thismonth':
             return [$this->carbon->today()->startOfMonth(), $this->carbon->tomorrow()];
         case 'lastmonth':
             return [$this->carbon->today()->subMonth()->startOfMonth(), $this->carbon->today()->subMonth()->endOfMonth()];
     }
 }
开发者ID:killtw,项目名称:repository,代码行数:23,代码来源:RangeCriteria.php

示例4: setUp

 public function setUp()
 {
     parent::setUp();
     $this->request = m::mock('\\Illuminate\\Http\\Request');
     $this->themes = new Themes();
     self::$files->shouldReceive('exists')->andReturn(false);
     $this->lastWeek = Carbon::today()->subWeek()->format('Y-m-d');
     $this->yesterday = Carbon::yesterday()->format('Y-m-d');
     $this->today = Carbon::today()->format('Y-m-d');
     $this->tomorrow = Carbon::tomorrow()->format('Y-m-d');
     $this->nextWeek = Carbon::today()->addWeek()->format('Y-m-d');
 }
开发者ID:petercoles,项目名称:themes,代码行数:12,代码来源:MatchDatesTest.php

示例5: initDateFilterGroup

 public function initDateFilterGroup($workspace, $extra = null)
 {
     if ($extra == null) {
         return null;
     }
     if ($workspace) {
         $beginDate = $workspace->W_DATE_BEGIN;
         $endDate = $workspace->W_DATE_END;
     } else {
         $beginDate = Carbon::yesterday();
         $endDate = Carbon::now();
     }
     foreach ($extra as $id => $item) {
         switch ($item['id']) {
             case 'date_begin':
                 $item['value'] = $beginDate;
                 break;
             case 'date_end':
                 $item['value'] = $endDate;
                 break;
             default:
                 break;
         }
         $extra[$id] = $item;
     }
     return $extra;
 }
开发者ID:hunglmtb,项目名称:eb,代码行数:27,代码来源:ProductionGroupComposer.php

示例6: index

 public function index()
 {
     //using function from the Trait currentDate.
     $targetDay = $this->getCurrentDate();
     //retrieving data for the next 3 days prior and after the currentDate
     $dateDayAfter = Carbon::tomorrow();
     $dateDayBefore = Carbon::yesterday();
     $dateDayAfter2 = Carbon::tomorrow()->addDay();
     $dateDayAfter3 = Carbon::tomorrow()->addDays(2);
     $weekBeforeObject = Carbon::yesterday()->subDays(6);
     $weekAfterObject = Carbon::tomorrow()->addDays(6);
     $dateDayBefore2 = Carbon::yesterday()->subDay();
     $dateDayBefore3 = Carbon::yesterday()->subDays(2);
     //putting the data in the array using the function inside the controller
     $dayAfter = $this->dateObjectToArray($dateDayAfter);
     $dayBefore = $this->dateObjectToArray($dateDayBefore);
     $dayAfter2 = $this->dateObjectToArray($dateDayAfter2);
     $dayAfter3 = $this->dateObjectToArray($dateDayAfter3);
     $dayBefore2 = $this->dateObjectToArray($dateDayBefore2);
     $dayBefore3 = $this->dateObjectToArray($dateDayBefore3);
     $weekBefore = $this->dateObjectToArray($weekBeforeObject);
     $weekAfter = $this->dateObjectToArray($weekAfterObject);
     $data = ['thisDay' => '', 'thisWeek' => "class = active ", 'thisMonth' => '', 'id' => 'thisWeek'];
     // $listdata = $this->listRepository->getLists();
     return view('main-tabs.thisWeek', $data)->with('targetDay', $targetDay)->with('dayBefore', $dayBefore)->with('dayAfter', $dayAfter)->with('dayAfter2', $dayAfter2)->with('dayAfter3', $dayAfter3)->with('dayBefore2', $dayBefore2)->with('dayBefore3', $dayBefore3)->with('weekYearBefore', $weekBefore['currentYear'])->with('weekYearAfter', $weekAfter['currentYear'])->with('weekMonthBefore', $weekBefore['currentMonth'])->with('weekMonthAfter', $weekAfter['currentMonth'])->with('weekDayBefore', $weekBefore['currentDay'])->with('weekDayAfter', $weekAfter['currentDay']);
 }
开发者ID:Timmerdev,项目名称:timmer_app,代码行数:26,代码来源:ListsController.php

示例7: fire

 /**
  * Run the command
  */
 public function fire()
 {
     if (!\Config::get('coanda::coanda.daily_digest_enabled')) {
         $this->error('Daily digest emails are disabled.');
         return;
     }
     $offset = 0;
     $limit = 50;
     $from = \Carbon\Carbon::yesterday()->subDays(30);
     $to = \Carbon\Carbon::yesterday();
     $digest_data = ['summary_figures' => $this->history_repository->getDigestSummaryFigures(), 'history_list' => $this->history_repository->getAllPaginatedByTimePeriod($from->format('y-m-d') . ' 00:00:00', $to->format('y-m-d') . ' 23:59:59', 20), 'from' => $from, 'to' => $to];
     while (true) {
         $subscribers = $this->history_repository->getDigestSubscribers($limit, $offset);
         if ($subscribers->count() == 0) {
             $this->info('All done.');
             return;
         }
         foreach ($subscribers as $subscriber) {
             if ($subscriber->email) {
                 $email = $subscriber->email;
                 \Mail::send('coanda::admin.modules.history.emails.dailydigest', $digest_data, function ($message) use($email) {
                     $message->subject(\Config::get('coanda::coanda.daily_digest_subject'));
                     $message->from(\Config::get('coanda::coanda.site_admin_email'), \Config::get('coanda::coanda.site_name'));
                     $message->to($email);
                 });
                 $this->info('Sent digest email to: ' . $email);
             }
         }
         $offset += $limit;
     }
 }
开发者ID:coandacms,项目名称:coanda-core,代码行数:34,代码来源:SendDailyDigest.php

示例8: handle

 /**
  * Execute the console command.
  * @return mixed
  */
 public function handle()
 {
     $client = new Client();
     //Call to EMS API to get the employee details
     $date = Carbon::yesterday()->format('Y-m-d');
     //$date = '2016-03-03';
     $ems_data = $client->get(env(APP_HOST) . "/" . EMS_API_PATH . 'employee_list/' . $date);
     if ($ems_data->getStatusCode() == STATUS_OK) {
         $data = json_decode($ems_data->getBody()->getContents());
         foreach ($data as $key => $ems) {
             $staff = Staff::whereEmail($ems->employee_email_id)->first();
             if (!empty($staff)) {
                 //Find JIRA hours
                 $worklog = Timelog::whereStaffId($staff->id)->whereStarted($date)->sum('time_spent');
                 $actual_jira_hours = gmdate('H:i:s', $worklog);
                 $actual_ems_hours = $ems->actual_hours;
                 //Comparing EMS and JIRA hours
                 if ($actual_jira_hours != NULL && $actual_jira_hours != '00:00:00' && $actual_ems_hours != NULL && $actual_ems_hours != '00:00:00') {
                     $diffrence = $actual_ems_hours - $actual_jira_hours;
                     //IF difference is greater then 1 hour, then update EMS
                     // Call back to EMS to mark employee as half absent
                     $client->get(env(APP_HOST) . "/" . EMS_API_PATH . 'update_employee_timesheet/' . $ems->emp_id . '/' . $date . ($diffrence > ONE && $diffrence < FOUR) ? '/half' : '/full');
                 }
             }
         }
     }
 }
开发者ID:arsenaltech,项目名称:folio,代码行数:31,代码来源:CheckJiraHours.php

示例9: index

 public function index()
 {
     //getting the date today, and finding the corresponding list to it.
     $dateToday = $this->getCurrentDate();
     $dateObjectYesterday = Carbon::yesterday();
     $dateObjectTomorrow = Carbon::tomorrow();
     $dateArrayYesterday = $this->dateObjectToArray($dateObjectYesterday);
     $dateArrayTomorrow = $this->dateObjectToArray($dateObjectTomorrow);
     $dayBefore = $dateArrayYesterday['currentDay'] . "/" . $dateArrayYesterday['currentMonth'] . "/" . $dateArrayYesterday['currentYear'];
     $dayAfter = $dateArrayTomorrow['currentDay'] . "/" . $dateArrayTomorrow['currentMonth'] . "/" . $dateArrayTomorrow['currentYear'];
     //checks if a lists exists for a corresponnding date. If there is no list, returns a null value.
     $currentList = $this->listRepository->getSpecificList($dateToday['currentDay'] . "/" . $dateToday['currentMonth'] . "/" . $dateToday['currentYear']);
     if (!empty($currentList)) {
         $currentListID = $currentList->id;
         $logsData = $this->logRepository->getSpecificLogsByList($currentListID);
         if ($logsData->isEmpty()) {
             $logsData = null;
         }
     } else {
         $logsData = null;
     }
     $data = ['thisDay' => "class = active ", 'thisWeek' => '', 'thisMonth' => '', 'id' => 'thisDay'];
     $dayName = $dateToday['currentDayName'];
     $monthName = $dateToday['currentMonthName'];
     $day = $dateToday['currentDay'];
     $year = $dateToday['currentYear'];
     return view('main-tabs.thisDay', $data)->with('logsData', $logsData)->with('dayBefore', $dayBefore)->with('dayAfter', $dayAfter)->with('dayName', $dayName)->with('monthName', $monthName)->with('day', $day)->with('year', $year);
 }
开发者ID:Timmerdev,项目名称:timmer_app,代码行数:28,代码来源:LogController.php

示例10: testGetExecutionTime

 public function testGetExecutionTime()
 {
     $job = new Job();
     $this->assertEquals('N/A', $job->getExecutionTime());
     $job->started_at = Carbon::yesterday();
     $job->completed_at = Carbon::yesterday()->addMinutes(5);
     $this->assertEquals('5 minutes', $job->getExecutionTime());
 }
开发者ID:sellerlabs,项目名称:illuminated,代码行数:8,代码来源:JobTest.php

示例11: getDateEnd

 /**
  * @param $dateEnd
  * @return static
  */
 public static function getDateEnd($dateEnd)
 {
     if (!is_null($dateEnd)) {
         $dateEndCarbon = Carbon::createFromFormat("Y-m-d", $dateEnd);
     } else {
         $dateEndCarbon = Carbon::yesterday();
     }
     return $dateEndCarbon;
 }
开发者ID:jamset,项目名称:php-adjutants,代码行数:13,代码来源:CarbonPeriod.php

示例12: scopeUpcoming

 public function scopeUpcoming($query)
 {
     $events = EventOccurrence::all()->filter(function ($events) {
         return Carbon::Parse($events['date']) > Carbon::yesterday();
     })->map(function ($value, $key) {
         return $value['id'];
     });
     return $query->whereIn('id', $events);
 }
开发者ID:partio-scout,项目名称:kokous_backend,代码行数:9,代码来源:EventOccurrence.php

示例13: testParseWithTestValueSet

 public function testParseWithTestValueSet()
 {
     $notNow = Carbon::yesterday();
     Carbon::setTestNow($notNow);
     $this->assertEquals($notNow, Carbon::parse());
     $this->assertEquals($notNow, Carbon::parse(null));
     $this->assertEquals($notNow, Carbon::parse(''));
     $this->assertEquals($notNow, Carbon::parse('now'));
 }
开发者ID:ningcaichen,项目名称:laravel-4.1-quick-start-cn,代码行数:9,代码来源:TestingAidsTest.php

示例14: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     /* $dt = Carbon::create(2015, 12, 1, 0);
        $dt->addWeekdays(10); 
     
        echo $dt->subDay(1);*/
     if (Carbon::yesterday()->isWeekend()) {
         echo 'Party!';
     }
 }
开发者ID:rikardote,项目名称:sistem,代码行数:15,代码来源:TestController.php

示例15: seedDiscounts

 public function seedDiscounts()
 {
     $expired = Factory::create(new Discount(), ['start_at' => null, 'end_at' => Carbon::yesterday()]);
     $running = Factory::create(new Discount(), ['start_at' => Carbon::yesterday(), 'end_at' => Carbon::tomorrow()]);
     $running->products()->sync([1, 2, 3]);
     $running->save();
     $upcoming = Factory::create(new Discount(), ['start_at' => Carbon::tomorrow(), 'end_at' => null]);
     $upcoming->categories()->sync([5]);
     $upcoming->save();
 }
开发者ID:scottbedard,项目名称:oc-shop-plugin,代码行数:10,代码来源:dev_seeds.php


注:本文中的Carbon\Carbon::yesterday方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。