| Total Complexity | 8 |
| Total Lines | 56 |
| 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 | 33 | public function __construct(array $attributes = []) |
|
| 26 | 33 | } |
|
| 27 | |||
| 28 | /** |
||
| 29 | * Prepare a date for array / JSON serialization. |
||
| 30 | * |
||
| 31 | * @param \DateTimeInterface $date |
||
| 32 | * @return string |
||
| 33 | */ |
||
| 34 | 3 | protected function serializeDate(\DateTimeInterface $date) |
|
| 37 | } |
||
| 38 | |||
| 39 | 7 | public function links() |
|
| 42 | } |
||
| 43 | |||
| 44 | |||
| 45 | 24 | public function setExpiryAttribute($expiry) |
|
| 50 | 24 | } |
|
| 51 | |||
| 52 | 10 | public function clickLimitReached() |
|
| 53 | { |
||
| 54 | 10 | if($this->click_limit === null) { |
|
|
|
|||
| 55 | 6 | return false; |
|
| 56 | } |
||
| 57 | 4 | return $this->click_limit <= $this->links->sum('clicks'); |
|
| 58 | } |
||
| 59 | |||
| 60 | 6 | public function expired() |
|
| 66 | } |
||
| 67 | |||
| 68 | } |
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.