source: app/Services/Hashid.php@ e651d0d

develop
Last change on this file since e651d0d was 1c25bcf, checked in by Berat Kjufliju <kufliju@…>, 3 years ago

added 2fa, bug fixes, edited blades

  • Property mode set to 100644
File size: 577 bytes
RevLine 
[1c25bcf]1<?php
2
3namespace App\Services;
4
5use Hashids\Hashids;
6
7class Hashid
8{
9 protected $hashid;
10
11 public function __construct()
12 {
13 $this->hashid = new Hashids(config("app.key"), 6, "0123456789abcdefg");
14 }
15
16 public function decode($id)
17 {
18 return $this->hashid->decode($id)[0];
19 }
20
21 public function __call($method, $args)
22 {
23 if (!method_exists($this->hashid, $method)) {
24 throw new \Exception("Call to undefined method '{$method}'");
25 }
26
27 return call_user_func_array([$this->hashid, $method], $args);
28 }
29}
Note: See TracBrowser for help on using the repository browser.