12345678910111213141516171819202122232425262728293031 |
- <?php
- /**
- * 收藏模型
- */
- namespace app\model;
- use laytp\BaseModel;
- class Bill extends BaseModel
- {
- //模型名
- protected $name = 'bill';
- //附加属性
- protected $append = ['create_time_int'];
- //时间戳字段转换
- //关联模型
- public function userinfo(){
- return $this->belongsTo('app\model\User','uid','id')->bind(['nickname']);
- }
- //新增属性的方法
- public function getCreateTimeIntAttr($value, $data)
- {
- return isset($data['create_time']) ? strtotime($data['create_time']) : 0;
- }
- }
|