-1

This is an example of what I want to achieve in the vue component

<div v-for="emotion in emotions" class="cb-row">
    <h2>{{ emotion.em_name }}</h2>
</div>

I have created a function in the EmotionsController to return all data from the table

class EmotionsController extends Controller
{
    public function getEmotions() {

        $emotions = Emotions::all()->get();

        return $emotions;

    }
}

How do I then get this data into my vue component? It's being loaded into a form

4
  • you're missing input closure tag Commented Feb 14, 2020 at 11:23
  • Still having issues unfortunately. Do you know how to import data from the database table into the vue component? Commented Feb 14, 2020 at 11:32
  • return data in your Laravel Controller and in Vue you can receive it http get. Take a look here: stackoverflow.com/questions/36303720/… Commented Feb 14, 2020 at 11:56
  • I'm fairly new to laravel and vue. I don't quite understand how to get the data into the component. Could I just use a simple route? Commented Feb 14, 2020 at 12:39

1 Answer 1

0

You have to refer laravel documentation first. because it gave you everything what you want. Here's the link of your question https://laravel.com/docs/6.x/frontend#writing-vue-components

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.