public function tags() { $message_to_show = ""; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $tag = new Tags(); $tag_name = Input::get('tag_name'); // OK if (!empty($tag_name)) { $is_tag_already_exist = $tag->check_tag($tag_name); if (!$is_tag_already_exist) { $is_tag_inserted = $tag->insert_tag($tag_name); if ($is_tag_inserted) { $message_to_show = "Tag Inserted successfully"; return redirect("/admin/tags")->withMessage($message_to_show); } else { $message_to_show = "Tag Not Inserted, Try after some time"; } } else { $message_to_show = "Tag already exist, insert any other tag"; } } else { $message_to_show = "Complete info not given, please give all information"; } return redirect("/admin/tags")->withMessage($message_to_show); } else { $tag = new Tags(); $get_all_tags = $tag->get_all_tags(); if (!empty($get_all_tags)) { $return_data = $get_all_tags; } else { $return_data = "No Tag Found"; } return view('/admin/tags')->withTags($return_data); } }