I'm currently trying to route as follows:
- If user GETs
/account/- If session has
account_id, user is logged in; show his account information - If not, user is not logged in; show login/create form
- If session has
- If user POSTs
/account/- If input has
create, user wants to create account; create it - If not, user wants to login; find his account and go again to
/account/
- If input has
My routes are set this way:
Route::get('account', function() {
if (Session::has('account_id'))
return 'AccountsController@show';
else
return 'AccountsController@index';
});
Route::post('account', function() {
if (Input::has('create')) {
return 'AccountsController@create';
else
return 'AccountsController@login';
)};
This is somewhat how I would do with Rails, but I don't know how to point to the controller method. I just get the returned string as a result. I didn't find it in Laravel documentation (which I found really poor, or have I searched wrong?) neither in any other web tutorial.