Laravel - Amazon Product Api package not working

In Laravel, I am getting the following error,

(1/1) ReflectionException
Class App\Http\Controllers\amazonApi does not exist

AmazonController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class AmazonController extends Controller
{
    public function amazonApi() {
        $product = Amazon::lookup('B004VLKY8M')->json();
        dd($product);
    }
}

web.php

Route::get('/', function () {
    return view('welcome');
});

Route::get('/api','amazonApi@AmazonController');

Can someone please help?

1 answer

  • answered 2018-01-14 09:52 Alexey Mezenin

    Change the route to:

    Route::get('/api', 'AmazonController@amazonApi');