I have manipulated the DB data with the creation of Models, but in my most recent project I am tending to make use of Query Builder, but this is going wrong.
I would like to understand what is missing so that the code works perfectly. To begin I declare the facade to use DB in my controller. Here is the code.
public function putente(Request $request)
{
$putentes = DB::table('utentes')->where('nome',$request->get('putente'))->orWhere('bi_n', $request->get('putente'))->get();
if(count($putentes)>0)
{
return view('home', ['putentes'=>$putentes]);
}
}
In my view I try to get the data this way
{{$putentes->nome}}
But you're returning this error
ErrorException in db040389b09b4e77a2f0e7fafa9a269acda44af2.php line 45:
Trying to get property of non-object (View: C:\xampp\htdocs\admc\resources\views\home.blade.php)
Is there a problem with Query Builder projects instead of Models?