Vue js object property called within a blade call possible?

Posted 1 year ago by douglas_quaid

Hi I have the following inline-template for a list of courses

<courses inline-template>
        <div>
            <ul v-for="course in courses.data">
                <li><a href="{{ route('course.show', ['id' => @{{course.id}}]) }}"><b>@{{ course.name }}</b></a></li>
                <p>@{{ course.description }}</p>
                <ul v-for="lesson in course.lessons">
                    <li><a href="#"><b>@{{ lesson.name }}</b></a></li>
                    <p>@{{ lesson.description }}</p>
                </ul>
            </ul>
        </div>
    </courses>

I want to reference the route to a course nicknamed 'course.show' (/courses/{course}) and I want to pass in to the route the id that the vue course object has. However, Laravel is saying

Parse error: syntax error, unexpected '{'

How do I fix this call? Is this even possible to call vue js property inside of a laravel blade route function?

Thanks.

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.