| Total Complexity | 3 |
| Total Lines | 18 |
| Duplicated Lines | 0 % |
| Changes | 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) |
||
| 15 | { |
||
| 16 | return (bool) self::where('file_id', $fileId)->where('token', $token)->where('expires_at', '>', date('Y-m-d H:i:s'))->count(); |
||
| 17 | } |
||
| 18 | |||
| 19 | public static function grant($fileId, $expires = self::DEFAULT_PERIOD) |
||
| 26 | ]); |
||
| 27 | } |
||
| 28 | } |