/** * Update/Delete post from projects table have support for multi choice * @return string thats notices that projects were updated/modified */ public function post_index() { $data = Input::all(); $action = $data['action']; unset($data['action']); unset($data['csrf_token']); unset($data['index']); switch ($action) { case 'delete_selected': foreach ($data as $item) { Project::post_delete($item); } break; case 'publish_selected': foreach ($data as $item) { Project::post_update('published', '1', $item); } break; case 'draft_selected': foreach ($data as $item) { Project::post_update('draft', '1', $item); } break; default: # code... break; } return Redirect::to_route('dojo::index_project')->with('title', 'List of projects')->with('message', 'Project(s) Updated'); }