Skip to content

Soft delete notifications #4147

Answered by sh4msi
studiowizjo asked this question in Help
Sep 22, 2022 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

This is how I solved it, I hope it will be useful for you and other friends

.
App\Classes\MyDatabaseNotification.php

namespace App\Classes;

use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Notifications\DatabaseNotification;

class MyDatabaseNotification extends DatabaseNotification
{
    use SoftDeletes;

    protected $dates = ['deleted_at'];
}

App\Classes\MyNotifiable.php

namespace App\Classes;

use Illuminate\Notifications\Notifiable;

trait MyNotifiable
{
    use Notifiable;

    /**
     * Get the entity's notifications.
     */
    public function notifications()
    {
        return $this->morphMany(MyDatabaseNotification::class, 'notifiable')
            ->orderBy('…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@studiowizjo
Comment options

Comment options

You must be logged in to vote
2 replies
@studiowizjo
Comment options

@KhairulAzmi21
Comment options

Answer selected by studiowizjo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants