[Vuejs]-How to show database info in Laravel Blade with VUE

0👍

Standard way of doing that is you will be implementing an ajax request where your front-end or Vue will fetch the necessary information from back-end via ajax request.

Another way of achieving that is you will be using properties or attributes in VUE

from your information.vue add a props maybe customerName or orderId or both

<template>
<div id="information">

    <h4>Information {{ customerName }}</h4>
    <h4>ID {{ orderID }}</h4>

</div>
</template>

<script>
export default {
    props:["customerName","orderID"],
    name: "information"
}
</script>

<style scoped>

</style>

in you showcustomer.blade.php you can pass the data from php to your vue by adding attributes based on the property name declared on you vue template

<information customer-name="John Mahu" order-id="0099812-ABC" v-if="!showinfo"></information>

or populate from your PHP variable

<information customer-name="{{ $Customers->customer_name }}" order-id="{$Customers->some_order_id}" v-if="!showinfo"></information>

Read more about vue props
https://v2.vuejs.org/v2/guide/components-props.html

Leave a comment