| 1 | <?php |
||
| 14 | class CardView extends Model |
||
| 15 | { |
||
| 16 | use Validatable; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Timestamp enabled. |
||
| 20 | * |
||
| 21 | * @var bool |
||
| 22 | */ |
||
| 23 | public $timestamps = true; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Name of database table. |
||
| 27 | * |
||
| 28 | * @var string |
||
| 29 | */ |
||
| 30 | protected $table = 'card_view'; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * List of allowed columns to be used in $this->fill(). |
||
| 34 | * |
||
| 35 | * @var array |
||
| 36 | */ |
||
| 37 | protected $fillable = ['card_id', 'ip']; |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Get the card this view belong to |
||
| 41 | */ |
||
| 42 | public function card() |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Set ip |
||
| 49 | * |
||
| 50 | * @param string $value |
||
| 51 | * @return self |
||
| 52 | */ |
||
| 53 | public function setIpAttribute($value) |
||
| 59 | |||
| 60 | /** |
||
| 61 | * Get ip |
||
| 62 | * |
||
| 63 | * @return string |
||
| 64 | */ |
||
| 65 | public function getIpAttribute() |
||
| 69 | |||
| 70 | /** |
||
| 71 | * Get collection of validation rules for model attributes |
||
| 72 | * |
||
| 73 | * @return array |
||
| 74 | */ |
||
| 75 | protected function getRules(): array |
||
| 85 | } |
||
| 86 |