A
A
Alex Terechenko2020-07-14 11:35:49
Laravel
Alex Terechenko, 2020-07-14 11:35:49

Help with Laravel, DB fetch?

Good afternoon, tell me please, I ran into a problem when I access the database $post->description everything works, when I create a variable $desc = 'description' and pass it to $post->$desc it works, but when I have an array $ array = ['0' => id', '1' => 'name']; and i try to pass like $post->$array['0'] throws error Array to string conversion. how to solve this problem

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question