The problem:
I have an error with my Laravel 5.2 application, where a call for a class method results in Laravel not being able to locate the class.
I run a LAMP-stack.
I have tried various suggestions, with many people stumbling upon namespacing as the solution. I am new to Laravel, so there might be some elemental setup that I have done incorrectly. I have mainly looked into folder ownership and permissions.
I have also experienced this problem when calling a different controller provided by a library. However, I am not certain whether or not describing this problem would just obfuscate the real issue.
My error:
ReflectionException in Route.php line 264: Class App\Http\Controllers\SteamInventory does not exist
- in Route.php line 264
- at ReflectionMethod->__construct('App\Http\Controllers\SteamInventory', 'getInventory') in Route.php line 264
- at Route->signatureParameters('Illuminate\Database\Eloquent\Model') in Router.php line 859
- at Router->substituteImplicitBindings(object(Route)) in Router.php line 844
- at Router->substituteBindings(object(Route)) in Router.php line 827
- at Router->findRoute(object(Request)) in Router.php line 691
- at Router->dispatchToRoute(object(Request)) in Router.php line 675
- at Router->dispatch(object(Request)) in Kernel.php line 246
- at Kernel->Illuminate\Foundation\Http{closure}(object(Request))
- at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
- at Pipeline->Illuminate\Routing{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
- at CheckForMaintenanceMode->handle(object(Request), object(Closure))
- at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
- at Pipeline->Illuminate\Pipeline{closure}(object(Request))
- at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
- at Pipeline->Illuminate\Routing{closure}(object(Request))
- at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
- at Pipeline->then(object(Closure)) in Kernel.php line 132
- at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99
- at Kernel->handle(object(Request)) in index.php line 54
My route in /app/Http/routes.php
Route::group(['middleware' => ['auth']], function () {
Route::get('trades', 'SteamInventory@getInventory');
});
My controller in /app/Http/Controllers/SteamInventoryController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
class SteamInventoryController extends Controller
{
public function getInventory () {
return "test";
}
}