コード例 #1
0
ファイル: CrudController.php プロジェクト: yaddabristol/crud
 /**
  * Remove the specified resource from storage
  *
  * @api
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $this->item = call_user_func($this->model . '::findOrFail', $id);
     $this->beforeDestroy();
     $this->item->delete();
     return $this->redirector->getRedirect('destroy')->with('success', $this->name_singular . ' has been deleted.');
 }
コード例 #2
0
ファイル: BaseRepository.php プロジェクト: zi9o/projet-cv
 /**
  * Destroy a model.
  *
  * @param  int $id
  * @return void
  */
 public function destroy($id)
 {
     $this->model = $this->getById($id);
     $this->model->delete();
     return $this->model;
 }