samedi 10 octobre 2020

Target class [User] does not exist. - Laravel

         I am learning laravel. I tried many times but I didn't find what's the issue in my User controller. Team please go through the code and help me out.  Illuminate\Contracts\Container\BindingResolutionException Target class [User] does not exist.  
         

web.php file

            <?php

Blockquote

            use Illuminate\Support\Facades\Route;
            
            
            Route::get('/', function () {
                return view('welcome');
                //return redirect('sample');
            });
            
            // Route::get('sample/{id}',function($id){
            //     echo $id;
            //     return view('sample');
            // });
            
            // Route::view('sample','sample');
            // Route::redirect('youtube','sample');
            
            Route::get('users','User@index');
            Route::get('show','User@show');
            
            This is my controller
            
            <?php
            
            namespace App\Http\Controllers;
            
            use Illuminate\Http\Request;
            
            class User extends Controller
            {
                //
                function index()
                {
                    return ['name' => 'Abhishek'];
                }
                function show()
                {
                    echo "Hello controller";
                }
            }
        
        namespace App\Http\Controllers;
        
        use Illuminate\Http\Request;
        
        class User extends Controller
        {
            //
            function index()
            {
                return ['name' => 'Abhishek'];
            }
            function show()
            {
                echo "Hello controller";
            }
        }
        
        
         
     


 


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire