Issues (26)

src/models/InstamojoPayment.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 InstamojoPayment extends Model
9
{
10
    use SoftDeletes;
11
12
    /**
13
     * The table associated with the model.
14
     *
15
     * @var string
16
     */
17
    protected $table = 'instamojo_payment';
18
19
    /**
20
     * The attributes that are mass assignable.
21
     *
22
     * @var array
23
     */
24
    protected $fillable = ['user_id','buyer_email','buyer_name','buyer_phone','currency','amount','unit_price', 'fees','longurl','payment_id', 'payment_request_id','purpose','shorturl','request_status','payment_status', 'affiliate_commission', 'instrument_type', 'billing_instrument', 'created_by'];
25
    
26
    
27
    /**
28
     * The "booting" method of the model.
29
     *
30
     * @return void
31
     */
32
    public static function boot()
33
    {
34
        parent::boot();
35
36
        static::creating(function($model) {
37
            $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...
38
        });
39
40
        static::updating(function($model) {
41
            $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...
42
        });
43
    }
44
    
45
    /**
46
     * [user description]
47
     * @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...
48
     */
49
    public function user()
50
    {
51
        return $this->hasOne('App\User', 'id', 'user_id');
52
    }
53
}
54