app/http/controller/FirstController.php
public function delhi_property()
{
$sql = DB::table('property')->where('city', 'Delhi')->orWhere('city', 'New Delhi')->get();
return view('index',['results'=>$sql]);
}
资源/视图/index.blade.php
<h3>({{ $results->count() }}) Properties</h3>
路线/ web.php
Route::get('/','FirstController@delhi_property');
我是laravel 5.4的新手在这里,我在做什么我只是像上面提到的那样运行查询Controller并想在我的视图文件中打印行数但是当我检查它时显示一个错误,即
Undefined variable: result (View: D:\xampp\htdocs\real_estate\resources\views\index.blade.php)
那么我该如何解决这个问题呢?请帮我。
潇湘沐
阿晨1998
哆啦的时光机