ApplyParking.php 862 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace App\Models;
  3. use App\Traits\ModelHelpers;
  4. use Illuminate\Database\Eloquent\Model;
  5. class ApplyParking extends Model
  6. {
  7. use ModelHelpers;
  8. //
  9. protected $table = 'apply_parkings'; // 申请还车点
  10. protected $guarded = [];
  11. const IS_EXAMINE_OK = 1;
  12. const IS_EXAMINE_NO = 0;
  13. const IS_EXAMINE_FAILED = 2;
  14. public static $examineMaps = [
  15. self::IS_EXAMINE_NO => '未审核',
  16. self::IS_EXAMINE_OK => '已通过审核',
  17. self::IS_EXAMINE_FAILED => '未通过审核',
  18. ];
  19. public function users(){
  20. return $this->belongsTo(User::class,'user_id','id');
  21. }
  22. public function areas(){
  23. return $this->belongsTo(Area::class,'area_id','id');
  24. }
  25. public function updateExamine($id,$val){
  26. return self::query()->where('id',$id)->update(['is_examine' => $val]);
  27. }
  28. }