PayCity.php 946 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php namespace App\Models;
  2. use Illuminate\Database\Eloquent\Factories\HasFactory;
  3. use Illuminate\Database\Eloquent\Model;
  4. use App\Models\Traits\Custom\Login;
  5. /**
  6. * 设置支付城市模型
  7. *
  8. */
  9. class PayCity extends Model
  10. {
  11. use HasFactory,Login;
  12. // 与模型关联的表名
  13. protected $table = 'pay_city';
  14. // 是否主动维护时间戳
  15. public $timestamps = false;
  16. // 定义时间戳字段名
  17. // const CREATED_AT = 'insert_time';
  18. // const UPDATED_AT = 'update_time';
  19. /**
  20. * 编辑城市
  21. *
  22. */
  23. public function edit($id,$data)
  24. {
  25. // 更新时间
  26. $data['update_time'] = time();
  27. // 写入数据表
  28. $result = $this->query()->where([['id','=',$id]])->update($data);
  29. // 失败返回0
  30. if( !$result ) return 0;
  31. // 返回结果
  32. return $id;
  33. }
  34. }