Upsert on ACARS positions #572 (#573)

This commit is contained in:
Nabeel S
2020-02-22 16:03:01 -05:00
committed by GitHub
parent 6e87f7804c
commit 9ed07da9c3
6 changed files with 91 additions and 28 deletions

View File

@@ -2,6 +2,8 @@
namespace App\Support;
use App\Contracts\Model;
use Hashids\Hashids;
use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Support\Str;
use Nwidart\Modules\Facades\Module;
@@ -11,6 +13,24 @@ use Nwidart\Modules\Facades\Module;
*/
class Utils
{
/**
* Generate a new ID with a given length
*
* @param int [$length]
*
* @return string
*/
public static function generateNewId(int $length = null)
{
if (!$length) {
$length = Model::ID_MAX_LENGTH;
}
$hashids = new Hashids('', $length);
$mt = str_replace('.', '', microtime(true));
return $hashids->encode($mt);
}
/**
* Returns a 40 character API key that a user can use
*