with(['image'])->find(); } /** * 状态 */ public function getStatusTextAttr($value, $data) { $text = ''; if ($value == 1) { $text = '开启'; } else { $text = '关闭'; } return $text; } /** * 关联奖项 */ public function prize() { return $this->hasMany('app\\common\\model\\plus\\lottery\\LotteryPrize', 'lottery_id', 'lottery_id'); } /** * 关联文件库 */ public function image() { return $this->belongsTo('app\\common\\model\\file\\UploadFile', 'image_id', 'file_id') ->bind(['file_path']); } }