Keith Clark
Keith Clark

Reputation: 609

"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 use clause I am missing, but have NO idea what.

Any thoughts?

Upvotes: 1

Views: 86

Answers (1)

scrubmx
scrubmx

Reputation: 2556

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

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

Upvotes: 1

Related Questions