Support the ongoing development of Laravel.io →
posted 8 years ago
Database Blade

I followed the documentation to try the notification system of Laravel 5.3, but I just cannot display the values of the "data" column (message and action).

In this column, the data is saved as json encoded array (?) in a text field:

{"message":"New comment on your photos.","action":"\/photos\/9372"}

How do I access these values in a blade view? This does not work:

@forelse($notifications as $n)
    @php
        $data = $n->data;
    @endphp

    {!! $data["message"] !!}
@empty
    nothing
@endforelse

It says "index not found". I have tried lots of variants with json_decode and without, but can't get it to work.

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

h82 h82 Joined 1 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.