how to redirect from middleware in cakephp 5

29 Views Asked by At

I hope all are good there, I am developing web application in cakephp 5 and i need to redirect user when they no permission or they are not owner of particular article.. so i have already done some code this like create policy for user and article . I just need redirect from middleware and for this i would follow the cakephp 5 docs code example but its not working

this is middleware

enter image description here

now i set middleware class into authorization middleware but its not working just throw normal error

enter image description here

need to redirect rather then throw error

0

There are 0 best solutions below