ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
每一次安装之后都要从头开始,很烦,记录需要改动的地方 ### Curd的更改 #### 增加 ~~~  public function add()     {  ​          if ($this->request->isPost()) {              $post = $this->request->post();              $rule = [];              $this->validate($post, $rule);              try {                  $save = $this->modelClass->save($post);             } catch (\Exception $e) {                  $this->error('保存失败');             }              $save ? $this->success('保存成功',  url('index')) : $this->error('保存失败');         }  ​          $view = [              'info' => null,              'title' => '添加'         ];  ​          return view('', $view);  ​     } ~~~ #### 编辑 ~~~  ​      public function edit($id)     {              $list = $this->modelClass->find($id);          if (empty($list)) $this->error('data is not exist');          if ($this->request->isPost()) {              $post = $this->request->post();              $rule = [];              $this->validate($post, $rule);              try {                  $save = $list->save($post);             } catch (\Exception $e) {                  $this->error('保存失败');             }              $save ? $this->success('保存成功', url('index')) : $this->error('保存失败');         }  ​          $view = [              'info' => $list,              'title' => '编辑'         ];  ​          return view('add', $view);     } ~~~