本文整理汇总了PHP中Carbon\Carbon::minValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Carbon::minValue方法的具体用法?PHP Carbon::minValue怎么用?PHP Carbon::minValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Carbon\Carbon
的用法示例。
在下文中一共展示了Carbon::minValue方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: test_middleware_returns_redirect_with_invalid_data
public function test_middleware_returns_redirect_with_invalid_data()
{
\Session::set('reauthenticate.life', \Carbon\Carbon::minValue()->timestamp);
\Session::set('reauthenticate.authenticated', true);
$middleware = new \Mpociot\Reauthenticate\Middleware\Reauthenticate();
$closure = function () {
};
/** @var Illuminate\Http\Request $request */
$request = \Illuminate\Http\Request::create('http://reauthenticate.app/restricted', 'GET', ['password' => 'test']);
$request->setSession(app('session.store'));
/** @var Illuminate\Http\RedirectResponse $result */
$result = $middleware->handle($request, $closure);
$this->assertInstanceOf(Illuminate\Http\RedirectResponse::class, $result);
$this->assertEquals('http://localhost/auth/reauthenticate', $result->getTargetUrl());
$this->assertEquals(\Session::get('url.intended'), 'http://reauthenticate.app/restricted');
}
示例3: __construct
public function __construct()
{
ini_set('memory_limit', '256M');
$this->postQuery = new Post();
$from = \Input::get('from');
$to = \Input::get('to');
$site = \Input::get('site');
$this->excel = !!\Input::get('excel');
$this->fromCarbon = $from ? @new Carbon($from) : Carbon::minValue();
$this->toCarbon = $to ? @new Carbon($to) : Carbon::now();
$this->postQuery = $this->postQuery->where('date', '>', $this->fromCarbon);
$this->postQuery = $this->postQuery->where('date', '<', $this->toCarbon);
if (isset($site) && $site != 'total') {
$this->postQuery = $this->postQuery->where('site', '=', $site);
}
}
示例4: setTimeRange
/**
* Set a pre-defined filter to use
* @param string $time_range
*/
public function setTimeRange($time_range)
{
switch ($time_range) {
case "all":
$this->setUntilDate(Carbon::now());
$this->setFromDate(Carbon::minValue());
break;
case "today":
$this->setUntilDate(Carbon::now());
$this->setFromDate(Carbon::today());
break;
case "yesterday":
$this->setUntilDate(Carbon::today());
$this->setFromDate(Carbon::today()->subDay(1));
break;
case "last_7":
$this->setUntilDate(Carbon::now());
$this->setFromDate(Carbon::today()->subDays(7));
break;
case "this_week":
$this->setUntilDate(Carbon::now()->endOfWeek());
$this->setFromDate(Carbon::now()->startOfWeek());
break;
case "last_week":
$this->setUntilDate(Carbon::now()->endOfWeek()->subDays(7));
$this->setFromDate(Carbon::now()->startOfWeek()->subDays(7));
break;
case "this_month":
$this->setUntilDate(Carbon::now()->endOfMonth());
$this->setFromDate(Carbon::now()->startOfMonth());
break;
case "last_month":
$this->setUntilDate(Carbon::now()->endOfMonth()->subMonths(1));
$this->setFromDate(Carbon::now()->startOfMonth()->subMonth(1));
break;
case "this_year":
$this->setUntilDate(Carbon::now()->endOfYear());
$this->setFromDate(Carbon::now()->startOfYear());
break;
case "last_year":
$this->setUntilDate(Carbon::now()->endOfYear()->subYears(1));
$this->setFromDate(Carbon::now()->startOfYear()->subYears(1));
break;
}
}
示例5: cumulativeProfit
/**
* Cumulative profit
*/
public function cumulativeProfit()
{
$tmpTrialBalanceReport = new TrialBalanceReport(Carbon::minValue()->toDateString(), $this->to);
return config('default.starting_cash') + config('default.starting_bank') + $tmpTrialBalanceReport->profit;
}
示例6: testMinValue
public function testMinValue()
{
$this->assertLessThanOrEqual(-2147483647, Carbon::minValue()->getTimestamp());
}
示例7: history
public function history()
{
if (empty(Input::all())) {
return View::make('exhibitions.frontend.exhibitions.history');
}
$fields = [];
$fieldsNames = ['title', 'director'];
foreach ($fieldsNames as $name) {
if (Input::has($name)) {
$fields[$name] = Input::get($name);
}
}
$fields = array_reduce($fieldsNames, function ($fields, $name) {
if (Input::has($name)) {
$fields[$name] = Input::get($name);
}
return $fields;
}, []);
if (empty($fields)) {
return View::make('exhibitions.frontend.exhibitions.history');
}
$results = $this->repository->findBy($fields, Carbon::minValue(), $this->maxDate);
return View::make('exhibitions.frontend.exhibitions.history')->with('results', $results);
}
示例8: scopeDateRangeTo
public function scopeDateRangeTo($query, $to)
{
return $this->scopeDateRange($query, Carbon::minValue(), $to);
}
示例9: 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";
}
示例10: 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;
}
//.........这里部分代码省略.........