initial commit

This commit is contained in:
2022-01-04 13:27:11 -07:00
parent 3764dad884
commit aed6ca46c2
63 changed files with 3780 additions and 1 deletions

View File

@ -0,0 +1,43 @@
<?php
if (! function_exists('snake2Title')) {
/**
* Convert a snake case string to a title with spaces
* and every word capitalized.
*
* @param string $stakeSlug A snake case string, commonly a slug
*
* @return string
*/
function snake2Title(string $snakeSlug): string
{
$output = preg_replace('/\_/', ' ', $snakeSlug);
return ucwords($output);
}
}
if (! function_exists('carbon')) {
function carbon(?string $timestring = null)
{
$carbon = Carbon\Carbon::now(session('timezone_name'));
if (! empty($timestring)) {
$carbon = Carbon\Carbon::parse($timestring, session('timezone_name'));
}
return $carbon;
}
}
if (! function_exists('jddayofweek')) {
function jddayofweek(?int $intDay = null, int $mode = 0)
{
if (is_null($intDay)) {
$intDay = date('l');
}
if ($mode === 0) {
return $intDay;
}
return ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][$intDay];
}
}