lundi 28 mai 2018

Laravel undefined variable (but it is sent)

My PostController:

    $posts = Post::orderBy('created_at', 'desc')
                 ->where([['status', 'PUBLISHED'],['post_type', 'PORTFOLIO']])
                 ->paginate(9);

    $partners = Post::orderBy('created_at', 'desc')
                 ->where([['status', 'PUBLISHED'],['post_type', 'PARTNERS']])
                 ->get();
 //   return view('landing.onepageindex', ['posts' => $posts], ['pages' => $pages], ['partners' => $partners]);
    return view(
             'landing.onepageindex',
             ['posts' => $posts],
             ['pages' => $pages],
             ['partners' => $partners]
         );

I'm trying to do a foreach for the partners var, but it says its undefined, what am I doing wrong here? I'm rather new to Laravel, but this thing just got me confused. Am I not allowed to create 2 vars that go for the same post (just different post types)?

Posts and Pages work as they should, partners doesn't.

Thanks in advance.



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

Aucun commentaire:

Enregistrer un commentaire