tomcorbett / opentok-laravel

Laravel bundle for OpenTok
MIT License
9 stars 23 forks source link

Code sample not working in a Controller #6

Closed zedee closed 7 years ago

zedee commented 8 years ago

We're following the general usage example in a controller, but we're having problems with this:

$token = OpentokApi::generateToken($sessionId,
        array(
            'role' => Role::PUBLISHER
        )
    );

The application complains it cannot find the Role class. I'm unsure if it's due to a bad adaptation in the Laravel 5 fork, or if this also happened in Laravel 4.

The thing is, when using the OpentokApi facade, shall we have access to the rest of the classes 'included' in the OpentokApi instance? Or in the example the call should be Opentok\Opentok\Role::PUBLISHER ?

namelivia commented 8 years ago

I am including the Role class by adding this use statement: use OpenTok\Role; I would need some to confirm this, but Role is included in the root of OpenTok which is an OpenTok laravel dependency. As OpentokLaravelServiceProvider is making use of OpenTok/OpenTok the Role class would be out of the scope and would need to be included explicitely from OpenTok.

tomcorbett commented 7 years ago

Agreed, you will have to include the OpenTok\Role class use well "use OpenTok\Role". Closing unless this issue was not resolved, I will re-open