2017-11-18 12 views
0

毎回存在しないReflectionExceptionクラスUserControllerでは ReflectionException クラスUserControllerでは存在しませんLaravel5.4に私はこの問題を持って送信ボタンをヒット

<?php 
namespace app\Http\Controllers; 
    use App\User; 
    use Illuminate\Http\Request; 




    class UserController extends Controller { 

    public function postSignUp(Request $request) 
     { 
     $email = $request['email']; 
     $first_name = $request['first_name']; 
     $password = bcrypt($request['password']); 
     $user = new User(); 
     $user->email =$email; 
     $user->first_name=$first_name; 
      $user->password = $password; 
      $user->save(); 

      return redirect()->back(); 

        } 

       public function postSignIn(Request $request) 
        { 

         } 
         } 

マイルートファイル:あなたが使用

<?php 

namespace App\Providers; 

use Illuminate\Support\Facades\Route; 
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; 


class RouteServiceProvider extends ServiceProvider 
{ 
    /** 
    * This namespace is applied to your controller routes. 
    * 
    * In addition, it is set as the URL generator's root namespace. 
    * 
    * @var string 
    */ 
    protected $namespace = 'App\Http\Controllers'; 

    /** 
    * Define your route model bindings, pattern filters, etc. 
    * 
    * @return void 
    */ 
    public function boot() 
    { 
     // 

     parent::boot(); 
    } 

    /** 
    * Define the routes for the application. 
    * 
    * @return void 
    */ 
    public function map() 
    { 
     $this->mapApiRoutes(); 

     $this->mapWebRoutes(); 

     // 
    } 

    /** 
    * Define the "web" routes for the application. 
    * 
    * These routes all receive session state, CSRF protection, etc. 
    * 
    * @return void 
    */ 
    protected function mapWebRoutes() 
    { 
     Route::middleware('web') 
      ->namespace($this->namespace) 
      ->group(base_path('routes/web.php')); 


     Route::post('/signup',[ 
      'uses'=>'[email protected]', 
      'as'=>'signup' 
     ]); 



    } 

    /** 
    * Define the "api" routes for the application. 
    * 
    * These routes are typically stateless. 
    * 
    * @return void 
    */ 
    protected function mapApiRoutes() 
    { 
     Route::prefix('api') 
      ->middleware('api') 
      ->namespace($this->namespace) 
      ->group(base_path('routes/api.php')); 
    } 
} 

答えて

0

無効な名前空間。代わりに:あなたのUserControllerで中

namespace app\Http\Controllers; 

あなたが使用する必要があります。そのような

namespace App\Http\Controllers; 
+0

を試してみてください –

+0

私はprob lemはルートファイルからです –

+0

'composer dump-autoload'も実行してみてください –

0
namespace App\Http\Controllers; 
use Illuminate\Http\Request; 

使用namespaceを、私は同じエラーを取得するコマンドにphp artisan route:cache

php artisan route:clear

関連する問題