Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5 Class 'App\Http\Controllers\Cookie' not found

Tags:

laravel-5

I am trying to create a cookie in laravel 5 with

$cookie = Cookie::make('name', 'value');

in controller and i want to attach to the view. But it shows the error

Class 'App\Http\Controllers\Cookie' not found.

How to solve this problem ?

like image 983
user3543872 Avatar asked Jun 16 '15 07:06

user3543872


1 Answers

Most Class not found are usually caused my incorrect namespace:

try

$cookie = \Cookie::make('name', 'value');

or add use Cookie; in your class like so:

<?php namespace App\Http\Controllers;

use Cookie;

UserController extends Controller{

}
like image 116
Emeka Mbah Avatar answered Sep 29 '22 01:09

Emeka Mbah