lagdo /
tontine
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Siak\Tontine\Model; |
||
| 4 | |||
| 5 | use Illuminate\Database\Eloquent\Builder; |
||
| 6 | |||
| 7 | class Payable extends Base |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Indicates if the model should be timestamped. |
||
| 11 | * |
||
| 12 | * @var bool |
||
| 13 | */ |
||
| 14 | public $timestamps = false; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * The attributes that are mass assignable. |
||
| 18 | * |
||
| 19 | * @var array |
||
| 20 | */ |
||
| 21 | protected $fillable = [ |
||
| 22 | 'notes', |
||
| 23 | ]; |
||
| 24 | |||
| 25 | public function session() |
||
| 26 | { |
||
| 27 | return $this->belongsTo(Session::class); |
||
| 28 | } |
||
| 29 | |||
| 30 | public function subscription() |
||
| 31 | { |
||
| 32 | return $this->belongsTo(Subscription::class); |
||
| 33 | } |
||
| 34 | |||
| 35 | public function remitment() |
||
| 36 | { |
||
| 37 | return $this->hasOne(Remitment::class); |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @param Builder $query |
||
| 42 | * @param Session $session |
||
| 43 | * |
||
| 44 | * @return Builder |
||
| 45 | */ |
||
| 46 | public function scopeWhereSession(Builder $query, Session $session): Builder |
||
| 47 | { |
||
| 48 | return $query->where('session_id', $session->id); |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @param Builder $query |
||
| 53 | * |
||
| 54 | * @return Builder |
||
| 55 | */ |
||
| 56 | public function scopePaid(Builder $query): Builder |
||
| 57 | { |
||
| 58 | return $query->whereHas('remitment'); |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 59 | } |
||
| 60 | } |
||
| 61 |