Welcome Guest, Not a member yet? Register   Sign In
Filters in route not working in codeigniter 4.0.4
#1

(This post was last modified: 07-21-2020, 11:34 AM by seunex.)

Filter in route does not look to work this filter isLogged if i use it in GLobal filters it works but if use it in a specific route is does not effect at all

The function as no effect at all.
PHP Code:
$routes->get('upload''ItemUploadController::chooseCategory', ['filter' => 'isLogged''as' => 'userUploadItemStart']); 
Reply
#2

i'm using 4.0.4 and filter works on a specific route.


But i put my filter class in app/Filters directory.

Then i edit app/Config/Filters.php

eg

Code:
    public $aliases = [


'myfilter3'=> \App\Filters\MyFilter3::class,


......

public $filters = [
    



'myfilter3' => ['before' => ['removeBlog']],


//the nitty gritty of MyFilter3.php is

  session_start();
  $logic=isset($_SESSION['role']) ;

{
//logic

}
Reply
#3

Filters work fine while using it in filter.php am talking about using it in a specific route
Reply
#4

How specific is "specific" the code

Code:
'myfilter3' => ['before' => ['removeBlog']],
only works on this route :
Code:
$routes->get('removeBlog','Blog::delBlogForm');
Reply




Theme © iAndrew 2016 - Forum software by © MyBB