@@ -13,37 +13,37 @@ |
||
| 13 | 13 | |
| 14 | 14 | class File extends \Model { |
| 15 | 15 | |
| 16 | - public static $cols = [ |
|
| 17 | - 'name' => ['type' => 'text'], |
|
| 18 | - 'exchange_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'exchange'], |
|
| 19 | - 'size' => ['type' => 'number'], |
|
| 20 | - 'status' => ['type' => 'text'], |
|
| 21 | - 'deleted' => ['type' => 'bool'], |
|
| 22 | - 'date_create' => ['type' => 'dateTime'], |
|
| 23 | - ]; |
|
| 24 | - public static $dataManagers = [ |
|
| 25 | - 'manager' => [ |
|
| 26 | - 'cols' => [ |
|
| 27 | - 'name', 'size', 'status', 'deleted', 'date_create' |
|
| 28 | - ], |
|
| 29 | - ] |
|
| 30 | - ]; |
|
| 16 | + public static $cols = [ |
|
| 17 | + 'name' => ['type' => 'text'], |
|
| 18 | + 'exchange_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'exchange'], |
|
| 19 | + 'size' => ['type' => 'number'], |
|
| 20 | + 'status' => ['type' => 'text'], |
|
| 21 | + 'deleted' => ['type' => 'bool'], |
|
| 22 | + 'date_create' => ['type' => 'dateTime'], |
|
| 23 | + ]; |
|
| 24 | + public static $dataManagers = [ |
|
| 25 | + 'manager' => [ |
|
| 26 | + 'cols' => [ |
|
| 27 | + 'name', 'size', 'status', 'deleted', 'date_create' |
|
| 28 | + ], |
|
| 29 | + ] |
|
| 30 | + ]; |
|
| 31 | 31 | |
| 32 | - public function deleteFile() { |
|
| 32 | + public function deleteFile() { |
|
| 33 | 33 | if ($this->exchange && file_exists($this->exchange->path . '/' . $this->name)) { |
| 34 | - unlink($this->exchange->path . '/' . $this->name); |
|
| 34 | + unlink($this->exchange->path . '/' . $this->name); |
|
| 35 | 35 | } |
| 36 | 36 | $this->deleted = 1; |
| 37 | 37 | $this->save(); |
| 38 | - } |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - public static function relations() { |
|
| 40 | + public static function relations() { |
|
| 41 | 41 | return [ |
| 42 | 42 | 'exchange' => [ |
| 43 | 43 | 'model' => 'Exchange1c\Exchange', |
| 44 | 44 | 'col' => 'exchange_id' |
| 45 | 45 | ] |
| 46 | 46 | ]; |
| 47 | - } |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | 49 | } |