0

How to implement this syntax of Laravel below inside a Vue.js component?

@if(!Auth::guest())
    @if(Auth::user()->id === $post->user->id)
        <a href=#>edit</a>
    @endif
@endif 
1
  • Laravel Blade is rendered on the server, but Vue.js runs in the browser. You need to provide the user's credentials to your Vue application in JavaScript so that it can know what to do. In order to help you do that, we need some more information about the structure of your application and if your Vue.js code has any kind of access control in it yet. Commented Mar 27, 2019 at 1:55

1 Answer 1

1

This works now

<example-component :user="{{json_encode(Auth::user())}}"></example-component>

Exemple.vue

<template>
  <p>{{ user.name }}</p>
</template>export default {props : ['user']}
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.