如何使用Laravel在响应体中发送auth cookie


How to send the auth cookie in the response body with Laravel?

我使用的是Laravel 4.2,需要在对登录请求的响应中发送authcookie。

到目前为止,我尝试了Cookie::get('laravel_session'),但这只会返回客户端发回的cookie。

if (Auth::attempt(array('email' => Input::get('email'), 'password' => Input::get('password')))) {
    /* I need the auth token here */
}

想法?

这将执行以下操作:Session::getId()

明白了:我如何在Laravel中获取会话ID

这实际上做得很好:

Crypt::encrypt( Session::token() )