2017-10-05 76 views
0
<?php 
     namespace App\Http\Controllers; 
     use Illuminate\Http\Request; 
     use App\Http\Controllers\customer; 
     use App\Http\Requests; 

     class CustomerController extends Controller 
     { 
     public function index() 
     { 
     return view('insert'); 
     } 
     public function create() 
     { 

     } 
     public function store(Request $request) 
     { 

     $customer = new customer; 
     $customer->name = $request->name; 
     $customer->sex = $request->sex; 
     $customer->pob = $request->pob; 
     $customer->tel = $request->tel; 
     $customer->email = $request->email; 
     $customer->save(); 
     } 


     public function show() 
      { 

     return view('show'); 


      } 
     } 
?> 

我m到處誤差級」應用程序\ HTTP \控制器\客戶找不到Laravel 5.2
我已經使用App \ customer; 使用輸入; 爲什麼我會收到錯誤? 代碼中的問題是什麼?級「應用程序 HTTP 控制器客戶找不到Laravel 5.2

回答

1

如果您customer類是在App命名空間中,你需要使用:的

use App\customer; 

代替

use App\Http\Controllers\customer; 
0

這是簡單,你需要了解。確保你已經在app/Customer.php中創建了一個Customer.php模型,另一件重要的事情是你必須創建你的表格。之後,你需要加入這一行類像以前一樣: -

use App\Customer; 

希望它能幫助:)

相關問題