Enquiry.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: vanshao
  5. * Date: 2019-04-17
  6. * Time: 09:30
  7. */
  8. namespace App\Http\Models;
  9. use Illuminate\Database\Eloquent\Model;
  10. use Illuminate\Database\Eloquent\SoftDeletes;
  11. class Enquiry extends Model{
  12. use SoftDeletes;
  13. protected $table = 'enquiry';
  14. protected $primaryKey = 'id';
  15. protected $guarded=[];//批量赋值
  16. public function getStatusTitleAttribute(){
  17. switch ($this->status??0){
  18. case 1:
  19. return '未读';
  20. case 2:
  21. return '已读';
  22. default:
  23. return '';
  24. }
  25. }
  26. public function getTypeTitleAttribute(){
  27. switch ($this->type??0){
  28. case 1:
  29. return '解决方案';
  30. case 2:
  31. return '营销方案';
  32. case 3:
  33. return '建站';
  34. case 4:
  35. return '获取资讯';
  36. case 5:
  37. return '详细方案';
  38. default:
  39. return '普通询盘';
  40. }
  41. }
  42. }