57 lines
1.1 KiB
PHP
Raw Normal View History

2017-09-14 22:21:00 +03:00
<?php
namespace App\Models\Expense;
use App\Models\Model;
2017-11-26 15:20:17 +03:00
use Bkwld\Cloner\Cloneable;
2017-09-14 22:21:00 +03:00
use Sofa\Eloquence\Eloquence;
class Vendor extends Model
{
2017-11-26 15:20:17 +03:00
use Cloneable, Eloquence;
2017-09-14 22:21:00 +03:00
protected $table = 'vendors';
/**
* Attributes that should be mass-assignable.
*
* @var array
*/
protected $fillable = ['company_id', 'name', 'email', 'tax_number', 'phone', 'address', 'website', 'currency_code', 'enabled'];
/**
* Sortable columns.
*
* @var array
*/
public $sortable = ['name', 'email', 'phone', 'enabled'];
/**
* Searchable rules.
*
* @var array
*/
protected $searchableColumns = [
'name' => 10,
'email' => 5,
'phone' => 2,
'website' => 2,
'address' => 1,
];
public function bills()
{
return $this->hasMany('App\Models\Expense\Bill');
}
public function payments()
{
2017-10-28 01:57:49 +03:00
return $this->hasMany('App\Models\Expense\Payment');
2017-09-14 22:21:00 +03:00
}
public function currency()
{
return $this->belongsTo('App\Models\Setting\Currency', 'currency_code', 'code');
}
}