Questions.php 559 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App\Models;
  3. use App\Traits\ModelHelpers;
  4. use Illuminate\Database\Eloquent\Model;
  5. class Questions extends Model
  6. {
  7. use ModelHelpers;
  8. //
  9. protected $table = "questions";
  10. const READ_YES = 1;
  11. const READ_NO = 0;
  12. public static $readMaps = [
  13. self::READ_NO => '未读',
  14. self::READ_YES => '已读',
  15. ];
  16. public function users(){
  17. return $this->belongsTo(User::class,'user_id','id');
  18. }
  19. public function areas()
  20. {
  21. return $this->belongsTo(Area::class, 'area_id', 'id');
  22. }
  23. }