0

getting error when on adding new route from new or old controller. from php artisan route:list giving error

ReflectionException class 'App\Http\Controller\Classname not exist whether it exist and existing routes with same class working properly. running on xampp php 7.2

Web.php

Route::get('/selcetPlan','PlanStatusContoller@selectPlan');

PlanStatusController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Plandetails;

class PlanStatusController extends Controller
{
    public function selectPlan(){
        $plande=Plandetails::all();
        return view('panel.planselect')->with('plan',$plande);
    }
}

'''

 php artisan route:list

giving below error in cli

ReflectionException  : Class App\Http\Controllers\PlanStatusContoller does not exist at C:\xampp\htdocs\Project\vendor\laravel\framework\src\Illuminate\Container\Container.php:790
    786|         if ($concrete instanceof Closure) {
    787|             return $concrete($this, $this->getLastParameterOverride());}
    789|
  > 790|         $reflector = new ReflectionClass($concrete);
  Exception trace:
  1   ReflectionClass::__construct("App\Http\Controllers\PlanStatusContoller")
C:\xampp\htdocs\Project\vendor\laravel\framework\src\Illuminate\Containe
r\Container.php:790
  2 Illuminate\Container\Container::build("App\Http\Controllers\PlanStatusCont
oller") C:\xampp\htdocs\Project\vendor\laravel\framework\src\Illuminate\Containe
r\Container.php:667

  Please use the argument -v to see more details.
Manish
  • 13
  • 1
  • 8
  • 4
    Please add your routes file, and you controller code. – atymic Jul 20 '19 at 22:18
  • Have you checked out [this](https://stackoverflow.com/questions/32475892/reflectionexception-class-classname-does-not-exist-laravel) answer, by chance? – FullStackOfPancakes Jul 21 '19 at 02:54
  • Possible duplicate of [ReflectionException: Class ClassName does not exist - Laravel](https://stackoverflow.com/questions/32475892/reflectionexception-class-classname-does-not-exist-laravel) – atymic Jul 21 '19 at 04:56
  • @atymic route and controller code is attached . if i remove this route than every thing run perfectly. – Manish Jul 21 '19 at 08:31

1 Answers1

0

Possible causes are :

  1. Controller.php doesn't have a class that you defined in the web.php
  2. Controller you defined is wrong

*If you can attach your error with code, its easy for us to give you an exact answer

Try add this code under the namespace in PlanStatusController.php:

Use App\Http\Controllers\Controller
No One
  • 109
  • 10