QwSub.php 419 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace App\Model\qw;
  3. use Illuminate\Database\Eloquent\Model;
  4. class QwSub extends Model
  5. {
  6. public $table = "jm_qw_sub";
  7. public $timestamps = false;
  8. /**
  9. * 追加属性
  10. */
  11. protected $appends = [
  12. 'question_text'
  13. ];
  14. public function getQuestionTextAttribute()
  15. {
  16. $question = Qw::find($this->question_id);
  17. return $question->question ?? '';
  18. }
  19. }