Welcome Guest, Not a member yet? Register   Sign In
Before filters with main page redirect when I call a controller with ajax
#5

My filter

PHP Code:
namespace App\Filters;

use 
CodeIgniter\Filters\FilterInterface;
use 
CodeIgniter\HTTP\RequestInterface;
use 
CodeIgniter\HTTP\ResponseInterface;

class 
Is_logged implements FilterInterface
{
    public function before(RequestInterface $request$arguments null)
    {
        $model model('App\Models\Utility\Check');


        if (!$model->my_check()) : // return true or false

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

        endif;
    }


    public function after(RequestInterface $requestResponseInterface $response$arguments null)
    {
    }


As said, it works, the problem is in the ajax calls, I know that the behavior is logical, I would need to redirect the whole page and not just the block where ajax writes
Reply


Messages In This Thread
RE: Before filters with main page redirect when I call a controller with ajax - by serialkiller - 11-24-2022, 07:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB