kordix

Simple refactor doesn't work

Posted 10 months 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.

Reply to

Use Markdown with GitHub-flavored code blocks.