0

Route:

Route::resource('call-plan', 'CustomerCallPlanController');

Class

<?php 
namespace App\Http\Controllers\Customer;

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

class CustomerCallPlanController extends CustomerBaseController
{
    public function index()
    {
        dd('SUCCESS!');
    }

And I expect to see 'SUCCESS' message in blank page but I see this instead:

 ReflectionException in Container.php line 741:
    Class App\Http\Controllers\CustomerCallPlanController does not exist
    in Container.php line 741
    at ReflectionClass->__construct('App\Http\Controllers\CustomerCallPlanController') in Container.php line 741
    at Container->build('App\Http\Controllers\CustomerCallPlanController', array()) in Container.php line 631
    at Container->make('App\Http\Controllers\CustomerCallPlanController', array()) in Application.php line 674
    at Application->make('App\Http\Controllers\CustomerCallPlanController') in ControllerDispatcher.php line 85
    at ControllerDispatcher->makeController('App\Http\Controllers\CustomerCallPlanController') in ControllerDispatcher.php line 57
    at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\CustomerCallPlanController', 'index') in Route.php line 203

I see the message in exception tell App\Http\Controllers\CustomerCallPlanController it makes sense because my controller in Customer folder which means it should be App\Http\Controllers\Customer\CustomerCallPlanController How can I fix this

5
  • CustomerCallPlanController is diferrent from CustomerQueueController. Looks like a typo Commented Jun 3, 2016 at 14:10
  • Yeah its but I was edited here is the original..(same error) Commented Jun 3, 2016 at 14:15
  • Is it because your controller is in Customer but the route doesn't denote that? Commented Jun 3, 2016 at 14:26
  • @AndyHolmes yes completely true Commented Jun 3, 2016 at 14:29
  • So you'll need to do something like this I assume, laravel.com/docs/5.2/routing#route-group-namespaces Commented Jun 3, 2016 at 14:31

1 Answer 1

1

You can use a relative path:

Route::resource('call-plan', 'Customer\CustomerCallPlanController');

Check the docs under Controllers & Namespaces

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.