Test Failed
Branch develop (5056e3)
by Abhishek Kumar
05:17
created

Import::importLogs()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Ladybirdweb\ImportExport\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class Import extends Model
8
{
9
	protected $fillable = ['file', 'file_rows', 'db_cols', 'row_processed'];
10
11
12
    /**
13
    * Relationship with import export log model
14
    *
15
    * @return void
16
    */
17
    public function importLogs()
18
    {
19
    	return $this->hasMany( \Ladybirdweb\ImportExport\Models\ImportExportLog::class, 'op_id' );
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->hasMany(La...ortLog::class, 'op_id') returns the type Illuminate\Database\Eloquent\Relations\HasMany which is incompatible with the documented return type void.
Loading history...
20
    }
21
22
23
    /**
24
    * Model Map accessor
25
    *
26
    * Unserialize model map while retriving.
27
    * @param $value
28
    * @return string
29
    */
30
    public function getModelMapAttribute($value)
31
    {
32
        return unserialize( $value );
33
    }
34
35
36
    /**
37
    * Model Map mulator
38
    *
39
    * Serialize model map while storing.
40
    * @param $value
41
    * @return void
42
    */
43
    public function setModelMapAttribute($value)
44
    {
45
        $this->attributes['model_map'] = serialize( $value );
46
    }
47
48
49
    /**
50
    * DB cols accessor
51
    *
52
    * Unserialize model map while retriving.
53
    * @param $value
54
    * @return string
55
    */
56
    public function getDbColsAttribute($value)
57
    {
58
        return unserialize( $value );
59
    }
60
61
62
    /**
63
    * Model Map mulator
64
    *
65
    * Serialize model map while storing.
66
    * @param $value
67
    * @return void
68
    */
69
    public function setDbColsAttribute($value)
70
    {
71
        $this->attributes['db_cols'] = serialize( $value );
72
    }
73
}
74