v2 first commit

This commit is contained in:
denisdulici
2019-11-16 10:21:14 +03:00
parent 5b23e9c2c4
commit 6d50fa8442
3075 changed files with 3451681 additions and 65594 deletions

39
app/Utilities/helpers.php Normal file
View File

@ -0,0 +1,39 @@
<?php
use App\Traits\DateTime;
use Jenssegers\Date\Date;
if (!function_exists('user')) {
/**
* Get the authenticated user.
*
* @return \App\Models\Auth\User
*/
function user()
{
// Get user from api/web
if (request()->is('api/*')) {
$user = app('Dingo\Api\Auth\Auth')->user();
} else {
$user = auth()->user();
}
return $user;
}
}
if (!function_exists('company_date')) {
/**
* Format the given date based on company settings.
*
* @return string
*/
function company_date($date)
{
$date_time = new class() {
use DateTime;
};
return Date::parse($date)->format($date_time->getCompanyDateFormat());
}
}