Reputation:
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.
ReflectionException in Route.php line 264: Class App\Http\Controllers\SteamInventory does not exist
Route::group(['middleware' => ['auth']], function () {
Route::get('trades', 'SteamInventory@getInventory');
});
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
class SteamInventoryController extends Controller
{
public function getInventory () {
return "test";
}
}
Upvotes: 2
Views: 1993
Reputation: 346
Change your Route
Route::get('trades', 'SteamInventory@getInventory');
TO
Route::get('trades', 'SteamInventoryController@getInventory');
Upvotes: 0
Reputation: 50798
Change this
SteamInventory
To this
SteamInventoryController
In this
Route::get('trades', 'SteamInventory@getInventory');
Upvotes: 1