public function delete_category($delete_cat_id) { $user_info = Auth::user()->toArray(); if ($user_info['user_type'] == 2) { $category = new Category(); $is_category_deleted = $category->delete_category_by_id($delete_cat_id); return redirect("category/read_category"); if ($is_category_deleted) { return redirect("category/read_category"); } else { print_r('Data Not Deleted'); } } $message = "you are not admin. you can't delete any category."; return view('welcome')->withMessage($message); }