4 months ago

Laravel Vue - v-bind only works if logged in

Posted 4 months ago by JeroenvanRensen

Hi everyone,

I'm creating a forum with Laravel and I've got the following problem:

If I'm logged in in the browser, it totally works. But if I go to a private window, I got the following message:

Method Illuminate\Database\Eloquent\Collection::__toString() must not throw an exception, caught ErrorException: Trying to get property 'id' of non-object 

Does anyone know what to do?

Thank you! Jeroen

If you need more information, please ask me.

Here's the resources\views\threads\show.blade.php file, where I'm calling the replies component:

<replies :data="{{ $replies }}" @removed="repliesCount--"></replies>

And here's the Replies.vue component:

        <new-reply @created="add"></new-reply>

        <div v-for="(reply, index) in items">
            <reply :data="reply" @deleted="remove(index)"></reply>

    import Reply from './Reply.vue';
    import NewReply from './NewReply.vue';

    export default {
        props: [
        components: { Reply, NewReply },

        data() {
            return {

        methods: {
            add(reply) {

            remove(index) {
                this.items.splice(index, 1);


                toast('Your reply has been deleted!');

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