Issues (26)

src/models/InstamojoRefund.php (3 issues)

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
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
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