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


PHP Carbon::maxValue方法代码示例

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


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

示例1: friendlyCarbonDate

/**
 * Returns a user friendly string date format for date string or Carbon date object, with default
 * format or given - BUT also returns "Never" if Carbon date is max/min - or null.
 * @param mixed $date - a date parsable by Carbon, including a Carbon Date object
 * @param string $format
 */
function friendlyCarbonDate($date = null, $format =  'M j, Y') {
  // American style m/d/y:   'n/j/y'
  if (!$date) return "Never/None";
  $date = new Carbon($date);
  $min = Carbon::minValue();
  $max = Carbon::maxValue();
  if ($max->eq($date) || $min->eq($date)) return "Never/None";
  return $date->format($format);
}
开发者ID:pkirkaas,项目名称:PkExtensions,代码行数:15,代码来源:pkhelpers.php

示例2: __construct

 /**
  * Constructor to initialize attributes
  * @param $from
  * @param $to
  */
 public function __construct($from, $to)
 {
     $this->from = $from == null ? Carbon::minValue() : new Carbon($from);
     $this->to = $to == null ? Carbon::maxValue() : new Carbon($to);
     $this->from = $this->from->firstOfMonth();
     $this->to = $this->to->lastOfMonth();
     $this->sales = $this->sales();
     $this->opening_inventory = $this->openingInventory();
     $this->closing_inventory = $this->closingInventory();
     $this->purchases = $this->purchases();
     $this->profit = $this->profit();
     $this->total_debtors = $this->totalDebtors();
     $this->total_creditors = $this->totalCreditors();
     $this->cash = $this->cash();
     $this->bank = $this->bank();
 }
开发者ID:KingSloff,项目名称:POS,代码行数:21,代码来源:TrialBalanceReport.php

示例3: __construct

 /**
  * Stash\Item constructor, runs on object creation
  *
  * @param mixed $data    Item data
  * @param int   $minutes Time in minutes until item expires
  */
 public function __construct($data, $minutes = 0)
 {
     $this->data = $data;
     $this->expires = $minutes == 0 ? Carbon::maxValue() : Carbon::now()->addMinutes($minutes);
 }
开发者ID:phlak,项目名称:stash,代码行数:11,代码来源:Item.php

示例4: testMaxValue

 public function testMaxValue()
 {
     $this->assertGreaterThanOrEqual(2147483647, Carbon::maxValue()->getTimestamp());
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:4,代码来源:NowAndOtherStaticHelpersTest.php

示例5: scopeDateRangeFrom

 public function scopeDateRangeFrom($query, $from)
 {
     return $this->scopeDateRange($query, $from, Carbon::maxValue());
 }
开发者ID:KingSloff,项目名称:POS,代码行数:4,代码来源:DateRangeTrait.php

示例6: rptWork

 public function rptWork($code)
 {
     $report = $this->getReport($code);
     if (!is_object($report)) {
         $this->showError();
     }
     $clients = $this->getClients($report->getClients());
     if ($clients === false) {
         $this->showError();
     }
     $projects = $this->getProjects($clients);
     $stagesAll = $this->generateProjectsStages($projects);
     $clientsAll = $this->generateClients($clients);
     $clientsOrderAll = $this->generateProjectsClientsOrder($projects);
     $lastStagesAll = $this->generaProjectsLastStages($projects);
     $finishedClientsAll = $this->generateProjectsFinishedClients($projects, $clientsAll, $lastStagesAll);
     $eventsAll = $this->generateProjectsEvents($projects, $clientsAll);
     $balanceAll = $this->countBalance($projects);
     if ($report->getPeriod_from() != "0000-00-00") {
         $param_from = \Carbon\Carbon::createFromFormat("Y-m-d H:i:s", $report->getPeriod_from() . " 00:00:00");
     } else {
         $param_from = \Carbon\Carbon::minValue();
     }
     if ($report->getPeriod_to() != "0000-00-00") {
         $param_to = \Carbon\Carbon::createFromFormat("Y-m-d H:i:s", $report->getPeriod_to() . " 23:59:59");
     } else {
         $param_to = \Carbon\Carbon::maxValue();
     }
     foreach ($eventsAll as $key => $projectsF) {
         //PROJECTS
         foreach ($projectsF as $key1 => $clientsF) {
             //CLIENTS
             foreach ($clientsF as $key2 => $eventF) {
                 //EVENTS
                 if (is_null($eventF->getR_date())) {
                     $eventF->show = false;
                     continue;
                 }
                 if ($eventF->getState() != 2) {
                     $eventF->show = false;
                     continue;
                 }
                 $r_dateObj = \Carbon\Carbon::createFromFormat("Y-m-d H:i:s", $eventF->getR_date());
                 if ($r_dateObj->gte($param_to) || $r_dateObj->lte($param_from)) {
                     $eventF->show = false;
                 }
             }
         }
     }
     $balanceSummary = array("income" => 0, "cost" => 0, "profit" => 0, "wasted_time" => 0);
     $balanceProject = array("income" => 0, "cost" => 0, "profit" => 0, "wasted_time" => 0);
     $balanceClient = array("income" => 0, "cost" => 0, "profit" => 0, "wasted_time" => 0);
     foreach ($eventsAll as $keyP => $projectsF) {
         //PROJECTS
         $Pincome = 0;
         $Pcost = 0;
         $Pprofit = 0;
         $Pwasted_time = 0;
         foreach ($projectsF as $key => $clientsF) {
             //CLIENTS
             $income = 0;
             $cost = 0;
             $profit = 0;
             $wasted_time = 0;
             foreach ($clientsF as $eventF) {
                 //EVENTS
                 if (!$eventF->show) {
                     continue;
                 }
                 $income += !is_null($eventF->getIncome()) ? $eventF->getIncome() : 0;
                 $cost += !is_null($eventF->getCost()) ? $eventF->getCost() : 0;
                 $profit += !is_null($eventF->getProfit()) ? $eventF->getProfit() : 0;
                 $wasted_time += !is_null($eventF->getWasted_time()) ? $eventF->getWasted_time() : 0;
                 $balanceSummary["income"] += !is_null($eventF->getIncome()) ? $eventF->getIncome() : 0;
                 $balanceSummary["cost"] += !is_null($eventF->getCost()) ? $eventF->getCost() : 0;
                 $balanceSummary["profit"] += !is_null($eventF->getProfit()) ? $eventF->getProfit() : 0;
                 $balanceSummary["wasted_time"] += !is_null($eventF->getWasted_time()) ? $eventF->getWasted_time() : 0;
             }
             $balanceClient[$key] = array("income" => $income, "cost" => $cost, "profit" => $profit, "wasted_time" => $wasted_time);
             $Pincome += $income;
             $Pcost += $cost;
             $Pprofit += $profit;
             $Pwasted_time += $wasted_time;
         }
         $balanceProject[$keyP] = array("income" => $Pincome, "cost" => $Pcost, "profit" => $Pprofit, "wasted_time" => $Pwasted_time);
     }
     $clientsCount = 0;
     foreach ($clientsAll as $cl) {
         $clientsCount += count($cl);
     }
     $rurls = array();
     $rurls["refresh"] = new SimpleUrl();
     $aurls = $this->actionUrls;
     $texts = $this->texts;
     include "./view/report/reportView.php";
 }
开发者ID:Faradejus,项目名称:WorkFlow,代码行数:96,代码来源:rptApp.class.php

示例7: number

 private function number()
 {
     return rand(Carbon::now()->timestamp, Carbon::maxValue()->timestamp);
 }
开发者ID:thomasdola,项目名称:afrouteWeb,代码行数:4,代码来源:BookingsController.php

示例8: fileConfig

 /**
  * @return array
  */
 private static function fileConfig() : array
 {
     return ['visibility' => Filesystem::VISIBILITY_PUBLIC, 'CacheControl' => 'max-age=315360000, public', 'Expires' => Carbon::maxValue()->format(DATE_RFC850)];
 }
开发者ID:hughgrigg,项目名称:ching-shop,代码行数:7,代码来源:NewImageListener.php

示例9: index

 /**
  * 模糊查询用户信息
  * @method queryUserInfo
  * @param  Request       $request 用户请求携带的数据
  * @return Json          $users   数据传递给视图
  */
 public function index(Request $request)
 {
     // DB::connection()->enableQueryLog();
     $user_cellphone_email = $request->get('user_cellphone_email', '');
     // 用户名|手机号|邮箱
     $city_id = $request->get('area', '');
     // 地域(城市ID)
     $user_grade = $request->get('user_grade', '');
     // 水平等级
     $reg_time = $request->get('reg_time', '');
     // 注册时间
     $account_grade = $request->get('account_grade', '');
     // 账号级别
     $account_end_at = $request->get('account_end_at', '');
     // 账号截止日期
     $month_duration = $request->get('month_duration', '');
     // 本月使用时长
     $account_status = $request->get('account_status', '');
     // 账号状态
     $change_duration = $request->get('change_duration', '');
     // 本月用时大幅变化
     $liveness = $request->get('liveness', '');
     // 活跃度
     $reg_start_time = $request->get('from_time', '');
     // 注册时间段 > 开始时间
     $reg_end_time = $request->get('to_time', '');
     // 注册时间段 > 结束时间
     $field = $request->get('field', 'regdate');
     // 排序字段
     $order = $request->get('order', 'desc');
     // 排序方式
     $user_type = $request->get('user_type', '');
     // 用户类型(手机号, 微信, QQ, 微博)
     $appends_arr = ['field' => $field, 'order' => $order];
     /**
      * 按字段不为这的情况,进行SQL语句拼接
      * "用户名"不为空
      */
     $users = StudentUser::select('*');
     if (!empty($user_cellphone_email)) {
         $appends_arr = array_merge($appends_arr, ['user_cellphone_email' => $user_cellphone_email]);
         $users->where(function ($query) use($user_cellphone_email) {
             $query->where('nickname', 'like', "%{$user_cellphone_email}%")->orWhere('cellphone', 'like', "%{$user_cellphone_email}%")->orWhere('email', 'like', "%{$user_cellphone_email}%");
         });
     }
     /**
      * "地域"不为空
      */
     if (!empty($city_id)) {
         $appends_arr = array_merge($appends_arr, ['city_id' => $city_id]);
         $users->where('city_id', $city_id);
     }
     /**
      * "水平等级"不为空
      */
     if (!empty($user_grade)) {
         $appends_arr = array_merge($appends_arr, ['user_grade' => $user_grade]);
         $users->where('user_grade', $user_grade);
     }
     /**
      * "注册时间"不为空
      */
     if (!empty($reg_time)) {
         $appends_arr = array_merge($appends_arr, ['reg_time' => $reg_time]);
         switch ($reg_time) {
             case 'day':
                 $start_time = Carbon::now('Asia/ShangHai')->startOfDay();
                 $end_time = Carbon::now('Asia/ShangHai')->endOfDay();
                 break;
             case 'week':
                 $start_time = Carbon::now('Asia/ShangHai')->subWeek();
                 $end_time = Carbon::now('Asia/ShangHai')->endOfDay();
                 break;
             case 'month':
                 $start_time = Carbon::now('Asia/ShangHai')->subMonth();
                 $end_time = Carbon::now('Asia/ShangHai')->endOfDay();
                 break;
             case 'half_year':
                 $start_time = Carbon::now('Asia/ShangHai')->subMonths(6);
                 $end_time = Carbon::now('Asia/ShangHai')->endOfDay();
                 break;
             case 'year':
                 $start_time = Carbon::now('Asia/ShangHai')->subyear();
                 $end_time = Carbon::now('Asia/ShangHai')->endOfDay();
                 break;
             case 'one_more_year':
                 $start_time = Carbon::minValue();
                 $end_time = Carbon::now('Asia/ShangHai')->endOfDay();
                 break;
             default:
                 $start_time = Carbon::minValue();
                 $end_time = Carbon::maxValue();
                 break;
         }
//.........这里部分代码省略.........
开发者ID:WangWeigao,项目名称:m1,代码行数:101,代码来源:UserController.php


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