コード例 #1
0
 /**
  * Remove the category.
  *
  * @param Model   $category
  *
  * @return Response
  */
 public function destroy(CategoryAdminRequest $request, Category $category)
 {
     try {
         $t = $category->delete();
         return response()->json(['message' => trans('messages.success.deleted', ['Module' => trans('faq::category.name')]), 'code' => 202, 'redirect' => trans_url('/admin/faq/category/0')], 202);
     } catch (Exception $e) {
         return response()->json(['message' => $e->getMessage(), 'code' => 400, 'redirect' => trans_url('/admin/faq/category/' . $category->getRouteKey())], 400);
     }
 }
コード例 #2
0
 /**
  * Remove the category.
  *
  * @param Request $request
  * @param Model   $category
  *
  * @return json
  */
 public function destroy(CategoryUserApiRequest $request, Category $category)
 {
     try {
         $t = $category->delete();
         return response()->json(['message' => trans('messages.success.delete', ['Module' => trans('faq::category.name')]), 'code' => 2006])->setStatusCode(202, 'DESTROY_SUCCESS');
     } catch (Exception $e) {
         return response()->json(['message' => $e->getMessage(), 'code' => 4006])->setStatusCode(400, 'DESTROY_ERROR');
     }
 }