12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php namespace App\Models;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\Model;
- use App\Models\Traits\Custom\Login;
- /**
- * 设置支付城市模型
- *
- */
- class PayCity extends Model
- {
- use HasFactory,Login;
- // 与模型关联的表名
- protected $table = 'pay_city';
- // 是否主动维护时间戳
- public $timestamps = false;
- // 定义时间戳字段名
- // const CREATED_AT = 'insert_time';
- // const UPDATED_AT = 'update_time';
- /**
- * 编辑城市
- *
- */
- public function edit($id,$data)
- {
- // 更新时间
- $data['update_time'] = time();
- // 写入数据表
- $result = $this->query()->where([['id','=',$id]])->update($data);
- // 失败返回0
- if( !$result ) return 0;
- // 返回结果
- return $id;
- }
- }
|