public function updatestate(Request $request) { $id = $request->input('id'); $state = $request->input('state'); $values = ['id' => $id, 'state' => $state]; Product::updateState($values); if ($state == 'ACTIVE') { return redirect()->action('ProductController@index', ['item' => $id]); } if ($state == 'DELETED') { return redirect('results')->with('status', 'Product has been deleted successfully'); } }