'小时', 'day' => '天', ]; } public function getCategoryOptions($type='product'){ return Category::where('status','1')->where('type',$type)->column('id,title'); } public function category() { return $this->belongsTo('Category', 'category_id', 'id');//->setEagerlyType(0); } public function questionnaire() { return $this->belongsTo('Questionnaire', 'questionnaire_id', 'id');//->setEagerlyType(0); } function setStartTimeAttr($v='',$row=[]){ if($v){ return strtotime($v); } return $v; } // function getStartTimeAttr($v='',$row=[]){ // if($v){ // return is_numeric($v) ? date('Y-m-d H:i:s',$v) : $v; // } // return ''; // } function setEndTimeAttr($v='',$row=[]){ if($v){ return strtotime($v); } return $v; } // function getEndTimeAttr($v='',$row=[]){ // if($v){ // return is_numeric($v) ? date('Y-m-d H:i:s',$v) : $v; // } // return ''; // } }