Welcome Guest, Not a member yet? Register   Sign In
redirect a user from a main controller
#1

(This post was last modified: 07-13-2021, 03:13 PM by Z4K7.)

I am created a login project
I am presenting a difficulty since at the time of the user entering the login, it is not redirecting to the web that I want but it remains in the login validator
the file structures is yes

PHP Code:
<?php 

namespace App\Controllers;


class 
Admin_Controller extends BaseController
{
 


 public function 
ingresar_panal()
 {

 return 
redirect()->to('panel');

 }

}
?>


this is my main controller where I would give the whole body of the more controllers

this is the login controller

PHP Code:
<?php

namespace App\Controllers\admin;
use 
App\Controllers\Admin_Controller;

class 
Login extends Admin_Controller


 public function 
index()
 {

 echo 
view('admin/login');
 
 }
 public function 
validacion()
 {
 
$this->ingresar_panal();
}
The login is validated without any problembut when you click on the login buttonit is not redirecting where you would have to enter if not only it remains in login


ya valide desde la configuraciĆ³n de Router 
PHP Code:
$routes->get('/''Login::index');
$routes->Post('login''Login::validacion');
$routes->get('panel''Panel::index'); 

It could help me what is the failure since if I place the redirection from the following way if it works


PHP Code:
<?php

namespace App\Controllers\admin;
use 
App\Controllers\Admin_Controller;

class 
Login extends Admin_Controller
{

public function 
index()
{

echo 
view('admin/login');

}
public function 
validacion()
{
return 
redirect()->to('panel');





and it is addressed where I want to but I don't understand if I do it from the main controller and call that one, it works, it is not working, it could help me or clarify what is happening

Thank you
Reply


Messages In This Thread
redirect a user from a main controller - by Z4K7 - 07-13-2021, 03:08 PM



Theme © iAndrew 2016 - Forum software by © MyBB