U
U
usdbuy2019-10-02 21:04:09
Laravel
usdbuy, 2019-10-02 21:04:09

How to insert php laravel loop in Vue?

Hello everyone, please tell me how can I insert a loop in the form (php laravel) in Vue. I need to pass the data from the loop to vue so that the data from the loop is displayed in the dropdown list

@foreach ($regions as $current)
      @if($current->parent_id)
        <li>
          <a href="{{ route('cabinet', [$category, $current]) }}">{{ $current->name }}</a>
        </li>
      @endif
@endforeach

<div id="app">
  <h1>Vue Select</h1>
  <v-select :options="options"></v-select>
</div>

new Vue({
            el: '#app',
            data: {
                options: [
                    1,4,5,11
                ]
            }
        })

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2019-10-02
@zkelo

Why do you need Vue on the client if you still want to write a PHP loop on the server?
You need to use Vue. You have to loop through Vue, not through Laravel
Documentation

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question