Changeset View
Changeset View
Standalone View
Standalone View
src/app/Utils.php
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | class Utils | ||||
{ | { | ||||
$request = \request(); | $request = \request(); | ||||
$ip = $request->ip(); | $ip = $request->ip(); | ||||
return self::countryForIP($ip); | return self::countryForIP($ip); | ||||
} | } | ||||
/** | /** | ||||
* Shortcut to creating a progress bar of a particular format with a particular message. | |||||
* | |||||
* @param \Illuminate\Console\OutputStyle $output Console output object | |||||
* @param int $count Number of progress steps | |||||
* @param string $message The description | |||||
* | |||||
* @return \Symfony\Component\Console\Helper\ProgressBar | |||||
*/ | |||||
public static function createProgressBar($output, $count, $message = null) | |||||
{ | |||||
$bar = $output->createProgressBar($count); | |||||
$bar->setFormat( | |||||
'%current:7s%/%max:7s% [%bar%] %percent:3s%% %elapsed:7s%/%estimated:-7s% %message% ' | |||||
); | |||||
if ($message) { | |||||
$bar->setMessage($message . " ..."); | |||||
} | |||||
$bar->start(); | |||||
return $bar; | |||||
} | |||||
/** | |||||
* Return the number of days in the month prior to this one. | * Return the number of days in the month prior to this one. | ||||
* | * | ||||
* @return int | * @return int | ||||
*/ | */ | ||||
public static function daysInLastMonth() | public static function daysInLastMonth() | ||||
{ | { | ||||
$start = new Carbon('first day of last month'); | $start = new Carbon('first day of last month'); | ||||
$end = new Carbon('last day of last month'); | $end = new Carbon('last day of last month'); | ||||
▲ Show 20 Lines • Show All 455 Lines • Show Last 20 Lines |