A
A
AlpineMilk2020-07-20 21:18:59
Laravel
AlpineMilk, 2020-07-20 21:18:59

how to pass variable from laravel to vue?

Hello! I'm making a SPA application on laravel + vue, I had such a question, there is a table
5f15da66b580a223227378.png
In which the type is written for a specific number, for example 1 is Admin, 2 is user. With the usual approach (not SPA), I would simply write

return view('base', ['userTypes' => User::getUserTypes()]);

And the template would already have something like
{% if entity.active in userTypes|keys %}{{ userTypes[entity.active] }}{% endif %}
this piece of code is taken from the symphony to show what I would roughly do next. How can I pass a variable to a view? What would do a similar trick?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
snowmage, 2020-07-20
@snowmage

Four ways to pass data from Laravel to Vue

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question