コード例 #1
0
ファイル: ProductoController.php プロジェクト: elcuy/Novopan
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $record = Producto::find($id);
     // Validaciones
     if (count(RequisicionLinea::where('id_producto', $record->id)->get())) {
         return new AjaxResponse('error', 'Este producto ya ha sido usado en una requisición. No se puede eliminar');
     }
     $record->clases()->detach();
     $record->delete();
     return new AjaxResponse('success', '');
 }