I'm trying to load the value of a cookie in a controller in Laravel 5.1, but I'm getting this error:
FatalErrorException in SurveyController.php line 21: Call to undefined method Illuminate\Support\Facades\Request::cookie()
Here is my code:
<?php
namespace App\Http\Controllers;
use Response;
use Request;
use Illuminate\Routing\Controller;
use Cookie;
use Log;
class SurveyController extends Controller {
/**
* Index method. Decide to resume a survey or start a new one.
*/
public function index(Request $request) {
dd($request->cookie('survey_id'));
}
}
From what I can tell from the documents, this appears to be the correct way to load a cookie value. What am I doing wrong?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire