The documentation on the website is a bit lacking (http://fatfreeframework.com/routing-engine). I want to use the shorthand expression of POST:
$f3->route('POST /login','Auth::login');
How do you send params into the Auth->login() function above?
This is an alternative way of writing it, but a bit longer:
$f3->route('POST /login',
function($f3) {
$params = $f3->get('POST');
$Auth = new Auth;
$Auth->login($params['username'], $params['password']);
}
);
If you mean that the
Auth::login
should automatically receive the POST data as an argument, then you can't.All F3 route handlers receive the following arguments:
See here for an example.
Anyway, if the
Auth->login
function you're referring to is the one included in the framework, then it couldn't work in any manner since thelogin()
function is not a route handler. It simply returnsTRUE
orFALSE
. A route handler has to do a little bit more than that: for example, to reroute the user on success or to display the login form again on error.