akaunting/app/Models/Common/Recurring.php

42 lines
877 B
PHP
Raw Normal View History

2018-04-26 02:17:55 +03:00
<?php
namespace App\Models\Common;
2019-11-16 10:21:14 +03:00
use App\Abstracts\Model;
2018-05-02 00:59:55 +03:00
use App\Traits\Recurring as RecurringTrait;
2018-04-26 02:17:55 +03:00
class Recurring extends Model
{
2018-05-02 00:59:55 +03:00
use RecurringTrait;
2018-04-26 02:17:55 +03:00
2018-04-27 17:42:45 +03:00
protected $table = 'recurring';
2018-04-26 18:40:04 +03:00
/**
* Attributes that should be mass-assignable.
*
* @var array
*/
2018-04-27 17:42:45 +03:00
protected $fillable = ['company_id', 'recurable_id', 'recurable_type', 'frequency', 'interval', 'started_at', 'count'];
2018-04-26 18:40:04 +03:00
2018-04-26 02:17:55 +03:00
/**
2018-05-01 19:00:33 +03:00
* Get all of the owning recurable models.
2018-04-26 02:17:55 +03:00
*/
2018-04-27 17:42:45 +03:00
public function recurable()
2018-04-26 02:17:55 +03:00
{
return $this->morphTo();
}
2020-10-20 18:27:26 +03:00
/**
* Scope to get all rows filtered, sorted and paginated.
*
* @param \Illuminate\Database\Eloquent\Builder $query
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeAllCompanies($query)
{
return $query->where('company_id', '<>', '0');
}
2018-04-26 02:17:55 +03:00
}