Search code examples
fuelphp

FuelPHP how to disable request and set another?


In the event 'request_created' I check authorization. If the user is not logged in, then I want to cancel the current Request and assign a new Request for a page Login. How to do it?


Solution

  • In 1.x the framework doesn't allow for request "hijacking". So your best options would be to use Response::redirect in the event listener. Optionally you could store the current URL (Uri::current()) in the session for a post login-redirect. Version 2.0 will have multiple ways to take over the request by returning a response in various places during the request cycle.