| 1 | <?php |
||
| 19 | class CloudStorage extends Model |
||
| 20 | { |
||
| 21 | use Concerns\UploadsFiles, |
||
| 22 | Concerns\TracksQuota, |
||
| 23 | Concerns\HasStorageAdapter, |
||
| 24 | Concerns\ManagesStorageConnection; |
||
| 25 | |||
| 26 | const SPACE_FULL = "full"; |
||
| 27 | const INVALID_TOKEN = "invalid"; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @var array |
||
| 31 | */ |
||
| 32 | protected $guarded = []; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @var array |
||
| 36 | */ |
||
| 37 | protected $casts = [ |
||
| 38 | 'token' => 'array', |
||
| 39 | 'connected' => 'boolean', |
||
| 40 | 'enabled' => 'boolean', |
||
| 41 | 'full' => 'boolean', |
||
| 42 | ]; |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @var array |
||
| 46 | */ |
||
| 47 | protected $dates = [ |
||
| 48 | 'space_checked_at', |
||
| 49 | 'uploaded_at', |
||
| 50 | 'disabled_at', |
||
| 51 | 'enabled_at' |
||
| 52 | ]; |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @return \Illuminate\Database\Eloquent\Relations\MorphTo |
||
| 56 | */ |
||
| 57 | public function owner() |
||
| 61 | |||
| 62 | /** |
||
| 63 | * If we have an owner, use the owning model name and identifier. |
||
| 64 | * Otherwise we'll have to just use the cloud storage email address. |
||
| 65 | * |
||
| 66 | * @return string |
||
| 67 | */ |
||
| 68 | public function getOwnerDescriptionAttribute() |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @return mixed |
||
| 77 | */ |
||
| 78 | public function getUserName() |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @return mixed |
||
| 85 | */ |
||
| 86 | public function getUserEmail() |
||
| 90 | } |