ClassifyRepairController.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Models\ClassifyRepair;
  4. use Illuminate\Http\Request;
  5. class ClassifyRepairController extends Controller
  6. {
  7. /**
  8. * Display a listing of the resource.
  9. *
  10. * @return \Illuminate\Http\Response
  11. */
  12. public function index()
  13. {
  14. //
  15. }
  16. /**
  17. * Show the form for creating a new resource.
  18. *
  19. * @return \Illuminate\Http\Response
  20. */
  21. public function create()
  22. {
  23. //
  24. }
  25. /**
  26. * Store a newly created resource in storage.
  27. *
  28. * @param \Illuminate\Http\Request $request
  29. * @return \Illuminate\Http\Response
  30. */
  31. public function store(Request $request)
  32. {
  33. //
  34. }
  35. /**
  36. * Display the specified resource.
  37. *
  38. * @param int $id
  39. * @return \Illuminate\Http\Response
  40. */
  41. public function show($id)
  42. {
  43. //
  44. }
  45. /**
  46. * Show the form for editing the specified resource.
  47. *
  48. * @param int $id
  49. * @return \Illuminate\Http\Response
  50. */
  51. public function edit($id)
  52. {
  53. //
  54. }
  55. /**
  56. * Update the specified resource in storage.
  57. *
  58. * @param \Illuminate\Http\Request $request
  59. * @param int $id
  60. * @return \Illuminate\Http\Response
  61. */
  62. public function update(Request $request, $id)
  63. {
  64. //
  65. }
  66. /**
  67. * Remove the specified resource from storage.
  68. *
  69. * @param int $id
  70. * @return \Illuminate\Http\Response
  71. */
  72. public function destroy($id)
  73. {
  74. //
  75. }
  76. public function AddClassify(Request $request)
  77. {
  78. $pid=$request->input('pid');
  79. $classify_name=$request->input('classify_name');
  80. $level=$request->input('level');
  81. $res=ClassifyRepair::where('classify_name',$classify_name)->first();
  82. if($res){
  83. return $this->fail(['40013','当前分类已存在']);
  84. }
  85. $re=new ClassifyRepair();
  86. $re->level=$level;
  87. $re->classify_name=$classify_name;
  88. $re->pid=$pid;
  89. $re->status=0;
  90. $re->save();
  91. return $this->success(['id'=>$re->id]);
  92. }
  93. }