| Total Complexity | 7 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class Group extends Model implements GroupModelContract |
||
| 11 | { |
||
| 12 | |||
| 13 | public $fillable = [ |
||
| 14 | 'expiry', |
||
| 15 | 'click_limit' |
||
| 16 | ]; |
||
| 17 | |||
| 18 | protected $dates = [ |
||
| 19 | 'expiry' |
||
| 20 | ]; |
||
| 21 | |||
| 22 | 32 | public function __construct(array $attributes = []) |
|
| 23 | { |
||
| 24 | 32 | parent::__construct($attributes); |
|
| 25 | 32 | $this->table = config('links.tables.groups'); |
|
| 26 | 32 | } |
|
| 27 | |||
| 28 | 7 | public function links() |
|
| 31 | } |
||
| 32 | |||
| 33 | |||
| 34 | 24 | public function setExpiryAttribute($expiry) |
|
| 39 | 24 | } |
|
| 40 | |||
| 41 | 10 | public function clickLimitReached() |
|
| 42 | { |
||
| 43 | 10 | if($this->click_limit === null) { |
|
|
|
|||
| 44 | 6 | return false; |
|
| 45 | } |
||
| 46 | 4 | return $this->click_limit <= $this->links->sum('clicks'); |
|
| 47 | } |
||
| 48 | |||
| 49 | 6 | public function expired() |
|
| 55 | } |
||
| 56 | |||
| 57 | } |
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.