kevin-mitchell / alexa-app

Set of classes to make creating Amazon Alexa Skills Kit (ASK) applications easier with Laravel and Lumen
MIT License
97 stars 47 forks source link

Route not found exception Laravel 5.7 #60

Closed dhavald99 closed 5 years ago

dhavald99 commented 5 years ago

{ "message": "", "exception": "Shttps://github.com/develpr/alexa-app/issues/60ymfony\Component\HttpKernel\Exception\NotFoundHttpException", "file": "{my-root-path}/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php", "line": 179, "trace": [ { "file": "{my-root-path}/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 636, "function": "match", "class": "Illuminate\Routing\RouteCollection", "type": "->" }, { "file": "{my-root-path}/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 625, "function": "findRoute", "class": "Illuminate\Routing\Router", "type": "->" }, ................. ] }

Api.php

AlexaRouter::launch('/alexa', 'AlexaController@alexalaunch');
AlexaRouter::intent('/alexa', 'GetAntiJoke', 'AlexaController@alexaGetJoke' );
AlexaRouter::intent('/alexa', 'GetColorIntent', 'AlexaController@alexaGetColor' );
AlexaRouter::intent('/alexa', 'TellColorIntent', 'AlexaController@alexaTellColor' );
AlexaRoute::sessionEnded ('/alexa', function () {
        return '{"version":"1.0","response":{"shouldEndSession":true}}';
    });

AlexaController.php --path=App\Http\Controllers `<?php

namespace App\Http\Controllers;

use Develpr\AlexaApp\Request\AlexaRequest; use Illuminate\Http\Request; use Develpr\AlexaApp\Facades\Alexa; use Develpr\AlexaApp\Response\AlexaResponse; use App\Http\Controllers\BaseApiController;

class AlexaController extends Controller {

function test () {
    dd('test');
}

/**
 * Alexa launch request.
 * @var alexa request data
 * @return json
 */
function alexalaunch(AlexaRequest $alexarequest) {
    return Alexa::ask ( "Hello, welcome to support center. You can ask say my color is red" )
    ->endSession ( 'false' );
}
/**
 * Alexa intent request.
 * @var alexa request data
 * @return json
 */
function alexaGetColor(AlexaRequest $alexarequest) {
    $color = $alexarequest->slot ( "color" );
    $session = Alexa::session ( 'color', $color );
    return Alexa::say ( "Great, your color is " . $color . ". Now you can ask me what's my color." )->endSession ( 'false' );
}

/**
 * Alexa intent request.
 * @var alexa request data
 * @return json
 */
function alexaGetJoke(AlexaRequest $alexarequest) {
    return Alexa::ask ( "Hello, welcome to support center. You can ask say my color is red" )
    ->endSession ( 'false' );
}

/**
 * Alexa intent request.
 * @var alexa request data
 * @return json
 */
function alexaTellColor() {
    $color = Alexa::session( 'color' );
    return Alexa::say ( 'I remember your color is ' . $color . ". Good Bye." )->endSession (‘true’);
}

/**
 * Alexa termination intent request.
 * @var alexa request data
 * @return json
 */
function alexaTerminate(AlexaRequest $alexarequest) {
    return Alexa::ask ( "Goodbye, have a nice day." )->endSession ();
}

}`

I seen many solution but not a single is working. can anyone please help with this?