| Total Complexity | 9 | 
| Total Lines | 69 | 
| Duplicated Lines | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 11 | class SimplePageNoAutoSlug extends Model implements SimplePageContract | ||
| 12 | { | ||
| 13 | use SoftDeletes; | ||
| 14 | |||
| 15 | protected $fillable = [ | ||
| 16 | 'title', | ||
| 17 | 'slug', | ||
| 18 | 'content', | ||
| 19 | 'show_in_menu', | ||
| 20 | 'public', | ||
| 21 | 'public_from', | ||
| 22 | 'public_until', | ||
| 23 | ]; | ||
| 24 | |||
| 25 | protected $casts = [ | ||
| 26 | 'public' => 'boolean', | ||
| 27 | 'show_in_menu' => 'boolean', | ||
| 28 | ]; | ||
| 29 | |||
| 30 | protected $dates = [ | ||
| 31 | 'public_from', | ||
| 32 | 'public_until', | ||
| 33 | 'created_at', | ||
| 34 | 'updated_at', | ||
| 35 | 'deleted_at', | ||
| 36 | ]; | ||
| 37 | |||
| 38 | public function __construct(array $attributes = []) | ||
| 39 |     { | ||
| 40 | parent::__construct($attributes); | ||
| 41 | |||
| 42 |         $this->table = config('simple-pages.table', 'pages'); | ||
| 43 | } | ||
| 44 | |||
| 45 | /** | ||
| 46 | * Attributes. | ||
| 47 | */ | ||
| 48 | protected function getIsPublicAttribute() | ||
| 49 |     { | ||
| 50 | if ( | ||
| 51 | $this->public == 1 | ||
|  | |||
| 52 | || ($this->public_from && $this->public_from < new Carbon()) | ||
| 53 | || ($this->public_until && $this->public_until > new Carbon()) | ||
| 54 |         ) { | ||
| 55 | return true; | ||
| 56 | } | ||
| 57 | |||
| 58 | return false; | ||
| 59 | } | ||
| 60 | |||
| 61 | /** | ||
| 62 | * Scopes. | ||
| 63 | */ | ||
| 64 | public function scopeVisibleInMenu($query): Builder | ||
| 67 | } | ||
| 68 | |||
| 69 | public function scopePublished($query): Builder | ||
| 84 | 
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.