E
E
Eugene Zalivadnyi2015-10-22 03:49:31
Laravel
Eugene Zalivadnyi, 2015-10-22 03:49:31

Why can't Laravel see the controller?

I follow the path site.ru/admin/currency
An error pops up: Class App\Http\Controllers\Admin\CurrencyController does not exist
Physically, the file exists in this folder.
Route (located in the routesAdmin.php file, next to routes.php):

Route::group(
    [
        'prefix' => 'admin',
        'middleware' => ['auth']
    ],
    function () {

        Route::get('currency', [
            'as' => 'admin.currency.index',
            'uses' => 'Admin\[email protected]'
        ]);
    });

Controller:
namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class CurrencyController extends Controller
{
    public function index()
    {
       return "ololo";
    }
}

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Muhammad, 2015-10-22
@agnamanshamansky

Namespace is incorrect, change it toApp\Http\Controllers\Admin

D
DieZz, 2015-10-22
@DieZz

You can change the route

Route::get('currency', [
            'as' => 'admin.currency.index',
            'uses' => '[email protected]'
        ]);

Or change the namespace of the controller, as answered Muhammad

J
javanub, 2015-10-22
@javanub

see comment

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question