Total Complexity | 5 |
Total Lines | 23 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class FileRemoteAccess extends Model { |
||
9 | const DEFAULT_PERIOD = '1 week'; |
||
10 | |||
11 | protected $table = 'filestorage_remote_access'; |
||
12 | protected static $unguarded = true; |
||
13 | |||
14 | public static function check($fileId, $token) |
||
17 | } |
||
18 | |||
19 | public static function grant($file, $expires = self::DEFAULT_PERIOD) |
||
20 | { |
||
21 | return self::create([ |
||
22 | 'file_id' => is_numeric($file)? $file: $file->id, |
||
23 | 'token' => md5(uniqid(rand(), true)), |
||
24 | 'created_by' => Auth::id()?: 0, |
||
25 | 'expires_at' => date('Y-m-d H:i:s', strtotime($expires)), |
||
26 | ]); |
||
27 | } |
||
28 | |||
29 | public function getHrefAttribute() |
||
31 | } |
||
32 | } |