我目前正在試圖路線如下:Laravel 4路由控制方法
- 如果用戶得到
/account/
- 如果會議有
account_id
,用戶登錄;顯示他的帳戶信息 - 如果不是,用戶未登錄;顯示登錄/創建表單
- 如果會議有
- 如果用戶發佈
/account/
- 如果輸入有
create
,用戶想要創建帳戶;創建它 - 如果不是,用戶想要登錄;發現他的帳戶,然後再次以
/account/
- 如果輸入有
我的路線設置是這樣的:
Route::get('account', function() {
if (Session::has('account_id'))
return '[email protected]';
else
return '[email protected]';
});
Route::post('account', function() {
if (Input::has('create')) {
return '[email protected]';
else
return '[email protected]';
)};
這有點我將如何使用Rails做,但我不知道怎麼點到控制器方法。我只是得到返回的字符串。我沒有在Laravel的文檔中找到它(我發現它很差,或者我搜索錯了?),在任何其他Web教程中都沒有找到它。
我沒有試過,但是,這一個可以幫助你:HTTP:// laravel .com/api/source-class-Illuminate.Routing.Controllers.Controller.html#93-127 – alayli