Пример #1
0
 /**
  * delete data
  * @return json
  */
 public function delete()
 {
     $id = (int) $_POST['id'];
     DB::beginTransaction();
     $rs1 = Type::destroy($id);
     if (!$rs1) {
         DB::rollback();
     }
     $attr = DB::select('select * from it_attributes where type_id = ?', [$id]);
     if ($attr) {
         $rs2 = Attribute::where('type_id', $id)->delete();
         if (!$rs2) {
             DB::rollback();
         }
     }
     DB::commit();
     if ($rs1) {
         return response()->json(array('status' => 200, 'message' => 'Deleted Successfully'));
     } else {
         return response()->json(array('status' => 400, 'message' => 'Delete Failure'));
     }
 }
Пример #2
0
 public function destroy($id)
 {
     Type::destroy($id);
     return back();
 }
Пример #3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Type::destroy($id);
     return back()->with('info', '删除成功~');
 }