InstamojoRefund   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 10
c 2
b 0
f 1
dl 0
loc 43
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A user() 0 3 1
A boot() 0 10 1
1
<?php
2
3
namespace IlyasKazi\Instamojo\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\SoftDeletes;
7
8
class InstamojoRefund extends Model
9
{
10
    use SoftDeletes;
11
12
    /**
13
     * The table associated with the model.
14
     *
15
     * @var string
16
     */
17
    protected $table = 'instamojo_refund';
18
19
    /**
20
     * The attributes that are mass assignable.
21
     *
22
     * @var array
23
     */
24
    protected $fillable = ['user_id','refund_id','payment_id','status','type','body','refund_amount','total_amount','created_by'];
25
    
26
    /**
27
     * The "booting" method of the model.
28
     *
29
     * @return void
30
     */
31
    public static function boot()
32
    {
33
        parent::boot();
34
35
        static::creating(function($model) {
36
            $model->created_by = \Auth::user()->id;
0 ignored issues
show
Bug introduced by
Accessing id on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
37
        });
38
39
        static::updating(function($model) {
40
            $model->updated_by = \Auth::user()->id;
0 ignored issues
show
Bug introduced by
Accessing id on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
41
        });
42
    }
43
    
44
    /**
45
     * [user description]
46
     * @return [type] [description]
0 ignored issues
show
Documentation Bug introduced by
The doc comment [type] at position 0 could not be parsed: Unknown type name '[' at position 0 in [type].
Loading history...
47
     */
48
    public function user()
49
    {
50
        return $this->hasOne('App\User', 'id', 'user_id');
51
    }
52
}
53