Skip to content
Advertisement

Data output from the database

I have a select and I want to output data from the DB

JavaScript

In CreateController I wrote this

JavaScript

I have a UserGuild database

JavaScript
JavaScript

And I have such a mistake

JavaScript

I need to output to select what is in the User Guide database, but at the same time where {{$guild->name}}and value were were values from the Guild database

I also tried using foreach, but it doesn’t suit me for further work.

JavaScript

Advertisement

Answer

Assuming the model and migration is correct, the problem lies in query which in this case returning boolean instead of collection, and then foreach in the blade view get passed boolean as an argument instead of collection because of this it will throw an error.

So instead using these condition === Auth::user()->id;, you can use where method to get data from database that correspond with id you want.

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement