CodeIgniter Forums
Detect redirect - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Detect redirect (/showthread.php?tid=75012)



Detect redirect - XTAZ - 12-07-2019

Hello!

IonAuth controller after user login execute "return redirect()->to('/');" and if fail execute "return redirect()->back()->withInput();".

I in my controllers extends IonAuth controller and I want redirect to /dashboard, if executed "return redirect()->to('/');", and dont touch in other cases.

How I can check this redirect?


PHP Code:
public function login()
{
    
$result parent::login();
    
    
check $result ?




RE: Detect redirect - MGatner - 12-08-2019

You want to check “if $result instanceof RedirectResponse”

E.g. https://github.com/tattersoftware/codeigniter4-workflows/blob/develop/src/Controllers/Runner.php#L132

CodeIgniter\HTTP\RedirectResponse is the full namespaced version


RE: Detect redirect - ProfessionalCoder - 12-12-2019

Auth::Check($this->session->has('login')))

you should check session ?