Completed
Push — master ( dab270...a45a25 )
by Abhishek Kumar
08:02
created

ImportExportLog   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 60
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getMessageAttribute() 0 3 1
A setMessageAttribute() 0 3 1
A setDataAttribute() 0 3 1
A getDataAttribute() 0 3 1
A import() 0 3 1
1
<?php
2
3
namespace Ladybirdweb\ImportExport\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class ImportExportLog extends Model
8
{
9
    protected $fillable = ['op_id', 'data', 'message'];
10
11
    /**
12
     * Relationship with import model.
13
     *
14
     * @return void
15
     */
16
    public function import()
17
    {
18
        return $this->belongsTo(\Ladybirdweb\ImportExport\Models\Import::class);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->belongsTo(...t\Models\Import::class) returns the type Illuminate\Database\Eloquent\Relations\BelongsTo which is incompatible with the documented return type void.
Loading history...
19
    }
20
21
    /**
22
     * Model Map accessor.
23
     *
24
     * Unserialize data while retriving.
25
     * @param $value
26
     * @return string
27
     */
28
    public function getDataAttribute($value)
29
    {
30
        return unserialize($value);
31
    }
32
33
    /**
34
     * Model Map mulator.
35
     *
36
     * Serialize data while storing.
37
     * @param $value
38
     * @return void
39
     */
40
    public function setDataAttribute($value)
41
    {
42
        $this->attributes['data'] = serialize($value);
43
    }
44
45
    /**
46
     * Model Map accessor.
47
     *
48
     * Unserialize message while retriving.
49
     * @param $value
50
     * @return string
51
     */
52
    public function getMessageAttribute($value)
53
    {
54
        return unserialize($value);
55
    }
56
57
    /**
58
     * Model Map mulator.
59
     *
60
     * Serialize message while storing.
61
     * @param $value
62
     * @return void
63
     */
64
    public function setMessageAttribute($value)
65
    {
66
        $this->attributes['message'] = serialize($value);
67
    }
68
}
69