master

laravel/framework

Last updated at: 29/12/2023 09:23

DatabaseNotificationCollection.php

TLDR

This file contains the DatabaseNotificationCollection class, which extends the Illuminate\Database\Eloquent\Collection class. This collection class is used to manage database notifications.

Methods

markAsRead

This method marks all notifications in the collection as read.

markAsUnread

This method marks all notifications in the collection as unread.

Classes

DatabaseNotificationCollection

This class extends the Illuminate\Database\Eloquent\Collection class and provides additional functionality for managing database notifications.

<?php

namespace Illuminate\Notifications;

use Illuminate\Database\Eloquent\Collection;

/**
 * @template TKey of array-key
 * @template TModel of DatabaseNotification
 *
 * @extends \Illuminate\Database\Eloquent\Collection<TKey, TModel>
 */
class DatabaseNotificationCollection extends Collection
{
    /**
     * Mark all notifications as read.
     *
     * @return void
     */
    public function markAsRead()
    {
        $this->each->markAsRead();
    }

    /**
     * Mark all notifications as unread.
     *
     * @return void
     */
    public function markAsUnread()
    {
        $this->each->markAsUnread();
    }
}