/** * @param string $pathToHash The path to hash * @param int $keepDays The number of days to keep the link active * * @return string The hash/token representing the unique owner-path pair. */ public function create($pathToHash, $keepDays = EnterpriseDefaults::SNAPSHOT_DAYS_TO_KEEP) { $_hash = sha1(md5($pathToHash) . microtime(true) . getmypid()); if (empty($keepDays) || $keepDays < 0 || $keepDays > 365) { $keepDays = EnterpriseDefaults::SNAPSHOT_DAYS_TO_KEEP; } $_model = RouteHash::create(['hash_text' => $_hash, 'actual_path_text' => $pathToHash, 'expire_date' => Carbon::createFromTimestamp(time() + $keepDays * DateTimeIntervals::SECONDS_PER_DAY)]); return $_model->hash_text; }