mercredi 3 juillet 2019

Laravel 5.7 How to get data from Controller show($id) function? Used Query builder

StaffController file

public function show($id)
    {
      $staffinfo = DB::table('staff')->where('user_id', $id)->get();
      return view('staff.view')->with('staffinfo', $staffinfo); }

view.blade.php file.

<h1></h1>
<p></p>

Is this code right to show data from staff table in view by show($id) function?

Geting error "Property [name] does not exist on this collection instance. (View: F:\xampp\htdocs\gchsc\resources\views\staff\view.blade.php)"



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire