Record.php 738 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace App\Repositories\Models\Exam;
  3. use App\Repositories\Models\Base\Admin;
  4. use App\Repositories\Models\Model;
  5. class Record extends Model
  6. {
  7. /**
  8. * @var string
  9. */
  10. protected $table = 'exam_records';
  11. protected $guarded = [];
  12. /**
  13. * The attributes excluded from the model's JSON form.
  14. *
  15. * @var array
  16. */
  17. protected $hidden = [];
  18. protected $casts = [
  19. 'result' => 'json',
  20. 'banks' => 'json',
  21. ];
  22. public function paper()
  23. {
  24. return $this->belongsTo(Paper::class)->select(['id', 'name']);
  25. }
  26. public function admin()
  27. {
  28. return $this->belongsTo(Admin::class)->with(['shop'])->select(['id', 'name', 'username','shop_id']);
  29. }
  30. }