1
我在Laravel新我嘗試這樣做:如何從URL傳遞變量DBcontroller
路由器
Route::get('productdetails/{id}', function($id){
'[email protected]' .$id;
});
ProductDetailsController
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class ProductDetailsController extends Controller
{
public function inventory(){
$inventory = DB::select('select * FROM inventory WHERE barcode = ?', [$id]);;
return view('productdetails',['inventory'=>$inventory]);
}
}
和我:
NotFoundHttpException在RouteCollection.php線161:
你試圖調用庫存的方法? –