lundi 2 avril 2018

Laravel 5.6 pass data from controller to view

Hello I am trying to pass table join from HomeController to View My controller:

public function index()
    {$YourData = DB::table('users')
            ->join('packages', 'users.id', '=', 'packages.user_id')
            ->select('users.*', 'packages.name')
            ->get();
            return view('home', compact('YourData'));}

My view:

foreach ($YourData as $dt) {
     //error here
                  }

I have seen laravel documentation and there inst very clear in how to do this!



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2EdWnyz
via IFTTT

Aucun commentaire:

Enregistrer un commentaire