I'm currently trying to get directions as follows:
- If the user is GET
/account/- If the session has
account_id, the user is logged in; show account information. - If not, the user is not logged in; show login / create form
- If custom post
/account/- If there is an input
create, the user wants to create an account; create it - If not, the user wants to log in; find his account and go to
/account/
My routes are set as follows:
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';
)};
Here's how to do it with Rails, but I don't know how to point to the controller method. As a result, I get the returned string. I did not find it in the Laravel documentation (what did I find very bad, or did I search incorrectly?) Not in any other web tutorial.