Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link to resource? #2

Open
ppisecky opened this issue Feb 2, 2019 · 5 comments
Open

Link to resource? #2

ppisecky opened this issue Feb 2, 2019 · 5 comments
Labels
enhancement New feature or request

Comments

@ppisecky
Copy link

ppisecky commented Feb 2, 2019

Is it possible to link to a resource in the notifications list?

@chrisbjr
Copy link
Member

chrisbjr commented Feb 2, 2019

Not at the moment. Will add this feature soon.

@chrisbjr chrisbjr added the enhancement New feature or request label Feb 2, 2019
@tumainimosha
Copy link

I am not sure if this is the same issue I am having or a different one.

In the toArray() method of notification, we supply the $url parameter, which I expected should act as clickable link for the notification.

However, I am unable to click through the notifications that pop-up.

is this expected behaviour, or there something missing in my setup.

@nilsE
Copy link

nilsE commented Jul 26, 2019

would be great to have a link!

@MGMonge
Copy link

MGMonge commented Aug 22, 2019

I needed a different template for the notifications on one of my projects so I made this PR #20 to allow custom notification templates

You can change the notification template completely like this.

// file: resources/views/custom-nova-notification-feed.blade.php

<notification-feed>
    <template v-slot="{ notification }">
        <notification-message :notification="notification" inline-template>
            <a class="notification table mt-4 table-fixed w-full" :href="notification.data.url">
                <div class="table-cell w-full">
                    <p v-html="notification.data.message"></p>
                    <span class="text-sm text-70">@{{ notification.created_at | fromNow }}</span>
                </div>
            </a>
        </notification-message>
    </template>
</notification-feed>

Will this feature help you guys @chrisbjr @ppisecky @tumainimosha @nilsE ?

@CaddyDz
Copy link

CaddyDz commented Aug 2, 2020

Here is how am doing it for now

public function toArray($notifiable): array
{
	$base_path = config('app.url') . config('nova.path');
	return [
		'level' => $this->level,
		'message' => $this->message,
		'url' => $base_path . '/resources/users/' . $this->user->id,
		'target' => '_self'
	];
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants