| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- namespace App\Models\Manager;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\Model;
- /**
- * 景区模型
- */
- class ScenicSpot extends Model
- {
- use HasFactory;
- protected $table = 'scenic_spot';
- public $timestamps = false;
- protected $connection = 'mysql';
- /**
- * 添加数据
- */
- public function add($data)
- {
- $data['insert_time'] = time();
- $data['update_time'] = time();
- $id = $this->query()->insertGetId($data);
- if (!$id) {
- return 0;
- }
- return $id;
- }
- /**
- * 更新数据
- */
- public function edit($id, $data)
- {
- $data['update_time'] = time();
- $result = $this->query()->where([['id', '=', $id]])->update($data);
- if (!$result) {
- return 0;
- }
- return $id;
- }
- }
|