__('Type 1'),'2' => __('Type 2'),'3' => __('Type 3')]; } public function getTypeTextAttr($value, $data) { $value = $value ? $value : $data['type']; $list = $this->getTypeList(); return isset($list[$value]) ? $list[$value] : ''; } public function book() { return $this->belongsTo('Book', 'book_id', 'id')->setEagerlyType(0); } }