@zocios you're using lists()
which returns an array. You cannot access an array with ->
notation, nor how you are trying to access it here. Your structure will return looking like ['Pittsburgh' => 1, 'Atlanta' =>2]
. When in doubt, use dd($var)
on your code to check your values when you don't think they are what they should be.
Thanks, machuga. I actually discovered an even more basic error which was that I had accidentally labelled the class for the cities table as "city", rather than "cities". So, of course, the class was not recognized, and therefore the attempt to use the class resulted in a non-object, with or without the use of lists(). Once I fixed the class name in Models, the error went away :)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community