Topic.php 755 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace App\Repositories\Models\Exam;
  3. use App\Repositories\Models\Course\Category;
  4. use App\Repositories\Models\Model;
  5. use Prettus\Repository\Contracts\Transformable;
  6. use Prettus\Repository\Traits\TransformableTrait;
  7. /**
  8. * Class Topic.
  9. *
  10. * @package namespace App\Repositories\Models\Exam;
  11. */
  12. class Topic extends Model implements Transformable
  13. {
  14. use TransformableTrait;
  15. protected $table = 'exam_topics';
  16. protected $casts = [
  17. 'body' => 'array',
  18. 'result' => 'array',
  19. ];
  20. /**
  21. * The attributes that are mass assignable.
  22. *
  23. * @var array
  24. */
  25. protected $guarded = [];
  26. public function category()
  27. {
  28. return $this->belongsTo(Category::class)->select(['id', 'name']);
  29. }
  30. }