lundi 7 octobre 2019

Search collection in blade

I have table users and catalogs.Catalogs have creator_id which is foreign key to id in Users table.Than I did this in PostsConstructor

 public function index()
    {
        $catalogs = Catalog::query()->get();
        $users = User::query()->get();

        return view('admin.posts',
            [
                'catalogs' => $catalogs,
                'users' => $users
            ]
        );
    }

where I send collections to posts.blade.php in post blade I have:

@foreach( $catalogs as $catalog )

<p>Created by </p>

@endforeach

I want to show who created this post but It shows error where my mistake is ? Thank you in advance!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire