| Total Complexity | 5 |
| Total Lines | 60 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class Import extends Model |
||
| 8 | { |
||
| 9 | protected $fillable = ['file', 'file_rows', 'db_cols', 'row_processed']; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * Relationship with import export log model. |
||
| 13 | * |
||
| 14 | * @return void |
||
| 15 | */ |
||
| 16 | public function importLogs() |
||
| 17 | { |
||
| 18 | return $this->hasMany(\Ladybirdweb\ImportExport\Models\ImportExportLog::class, 'op_id'); |
||
| 19 | } |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Model Map accessor. |
||
| 23 | * |
||
| 24 | * Unserialize model map while retriving. |
||
| 25 | * @param $value |
||
| 26 | * @return string |
||
| 27 | */ |
||
| 28 | public function getModelMapAttribute($value) |
||
| 29 | { |
||
| 30 | return unserialize($value); |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Model Map mulator. |
||
| 35 | * |
||
| 36 | * Serialize model map while storing. |
||
| 37 | * @param $value |
||
| 38 | * @return void |
||
| 39 | */ |
||
| 40 | public function setModelMapAttribute($value) |
||
| 41 | { |
||
| 42 | $this->attributes['model_map'] = serialize($value); |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * DB cols accessor. |
||
| 47 | * |
||
| 48 | * Unserialize model map while retriving. |
||
| 49 | * @param $value |
||
| 50 | * @return string |
||
| 51 | */ |
||
| 52 | public function getDbColsAttribute($value) |
||
| 53 | { |
||
| 54 | return unserialize($value); |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Model Map mulator. |
||
| 59 | * |
||
| 60 | * Serialize model map while storing. |
||
| 61 | * @param $value |
||
| 62 | * @return void |
||
| 63 | */ |
||
| 64 | public function setDbColsAttribute($value) |
||
| 67 | } |
||
| 68 | } |
||
| 69 |