akaunting/app/Models/Expense/BillPayment.php
2017-09-14 22:21:00 +03:00

49 lines
1.0 KiB
PHP

<?php
namespace App\Models\Expense;
use App\Models\Model;
use App\Traits\Currencies;
use App\Traits\DateTime;
class BillPayment extends Model
{
use Currencies, DateTime;
protected $table = 'bill_payments';
protected $dates = ['deleted_at', 'paid_at'];
/**
* Attributes that should be mass-assignable.
*
* @var array
*/
protected $fillable = ['company_id', 'bill_id', 'account_id', 'paid_at', 'amount', 'currency_code', 'currency_rate', 'description', 'payment_method', 'reference', 'attachment'];
public function account()
{
return $this->belongsTo('App\Models\Banking\Account');
}
public function bill()
{
return $this->belongsTo('App\Models\Expense\Bill');
}
public function item()
{
return $this->belongsTo('App\Models\Item\Item');
}
public function tax()
{
return $this->belongsTo('App\Models\Setting\Tax');
}
public function scopeLatest($query)
{
return $query->orderBy('paid_at', 'desc');
}
}