kordix
116
2
Laravel

Simple refactor doesn't work

Posted 1 year ago by kordix

this: $next = Question::where('id', '>', $id) ->min('id'); return redirect()->route('show', ['id'=>$next]); inside a function does work

but if I want to export this to another function and it just does nothing

Following function doesn't work:

public function setCounter($id, Request $request) { Question::find($id)->update(['counter'=> request('counter')]);

    session()->flash('message', 'Ok masz rację');
   $this->nextt($id);
}

public function nextt($id) { $next = Question::where('id', '>', $id) ->min('id'); return redirect()->route('show', ['id'=>$next]); }

It just makes no redirect It's just not possible to redirect by calling another function?

Please sign in or create an account to participate in this conversation.