Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

page not redirecting. when i redirecting by calling function #3729

Closed
khushmohammad opened this issue Oct 6, 2020 · 2 comments
Closed

page not redirecting. when i redirecting by calling function #3729

khushmohammad opened this issue Oct 6, 2020 · 2 comments
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@khushmohammad
Copy link

Direction
We use github issues to track bugs, not for support.
If you have a support question, or a feature request, raise these as threads on our
forum.

Describe the bug
A clear and concise description of what the bug is.

CodeIgniter 4 version
Which version (and branch, if applicable) the bug is in.

Affected module(s)
Which package or class is the bug in, if known.

Expected behavior, and steps to reproduce if appropriate
A clear and concise description of what you expected to happen,
and how you got there.
Feel free to include a text/log extract, but use a pastebin facility for any
screenshots you deem necessary.

Context

  • OS: [e.g. Windows 99]
  • Web server [e.g. Apache 1.2.3]
  • PHP version [e.g. 6.5.4]
@khushmohammad khushmohammad added the bug Verified issues on the current code behavior or pull requests that will fix them label Oct 6, 2020
@khushmohammad
Copy link
Author

public function checksession(){
$userId = session()->has('name');
if (!$userId) { return redirect()->to(base_url()); }

}
public function index()
{		
		$this->checksession();
		echo view('Header');
		echo view('Dashboard/Home');
		echo view('Dashboard/footer');
	
}

@khushmohammad khushmohammad changed the title page not redirecting. when i redirecting by call function page not redirecting. when i redirecting by calling function Oct 6, 2020
@lonnieezell
Copy link
Member

Not a bug.

You're not returning the RedirectResponse to the calling method, but not returning it out of the index() method itself. Read up on controller filters for a better solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

No branches or pull requests

2 participants