Keith Clark Keith Clark - 9 months ago 23
PHP Question

"Class" not found

Loaded the Natnanmac GUID generator from GitHub for Laravel in a 5.2 project.

I can call it from within a Blade view like:

<?php $myguid = GUID::generate(); ?>
{!! $myguid !!}<br />

and it generates a GUID just fine. If I try to use it within a controller like:

public function generateGUID()
$newguid = GUID::generate();

it throws a

FatalErrorException in MainController.php line 86:
Class 'App\Http\Controllers\GUID' not found

I have a feeling it is a
clause I am missing, but have NO idea what.

Any thoughts?


Is trying to find the class inside the App\Http\Controllers namespace. Try

public function generateGUID()
    $newguid = \GUID::generate();