Van1310
219
3
Laravel

Trying to get property of non-object

Posted 3 months ago by Van1310

i try to fetch multiple record using foreach

Here is my controller file

public function view($id)
{
    $print=Pay::where('id','=',$id)->select('duedate','amount')->first();        
    return view('admin',compact('print'));
}

Blade file

<td>Payment Confirmed</td>                                                 
@foreach($print as $prints)                                                                                               
<td class="m--font-danger">{{$prints->amount}}</td>         
@endforeach

Please sign in or create an account to participate in this conversation.