PHPackages                             tadasei/backend-trashable-notifications - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. tadasei/backend-trashable-notifications

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

tadasei/backend-trashable-notifications
=======================================

A package that provides stubs for soft deletable database notifications support

v1.2.2(1mo ago)154MITPHPPHP ^8.1.0

Since Sep 5Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/Tadasei/backend-trashable-notifications)[ Packagist](https://packagist.org/packages/tadasei/backend-trashable-notifications)[ RSS](/packages/tadasei-backend-trashable-notifications/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (9)Dependencies (12)Versions (10)Used By (0)

Tadasei/backend-trashable-notifications
=======================================

[](#tadaseibackend-trashable-notifications)

This package provides stubs for managing trashable (soft deletable) database notifications in the backend of a Laravel application. It simplifies common Index, Store, Update, and Delete notification operations by providing pre-defined structures.

Features
--------

[](#features)

- Quickly generate trashable database notifications management files and handling logic.
- Customize and extend generated code to fit your project's needs.
- Improve development efficiency by eliminating repetitive tasks.

Installation
------------

[](#installation)

Install the package via Composer by running:

```
composer require tadasei/backend-trashable-notifications --dev
```

Usage
-----

[](#usage)

### Publishing Trashable Notifications Management Utilities

[](#publishing-trashable-notifications-management-utilities)

To publish the utilities, including the supervisord configuration files, run:

```
php artisan trashable-notifications:install
```

This command generates all necessary files, including:

- Notification-related form requests.
- Policies for managing trashable notifications.
- A custom `Notifiable` trait.
- Route files for notification management.
- Database migration files.
- **Supervisord configuration files** for production queue management.

### Configuration

[](#configuration)

After publishing the utilities, follow these steps to complete the configuration:

1. **Form Request Configuration**: Modify the generated form request (`App\Http\Requests\SendNotificationRequest`) to suit your application's validation rules and logic.
2. **Policy Configuration**: Update the generated policy (`App\Policies\DatabaseNotificationPolicy`) to control access to notification management operations, ensuring it aligns with your project's authorization system.
3. **Notifiable Trait Replacement**: The package provides a custom `Notifiable` trait, which will be published along with the other management utilities. You must replace the built-in Laravel `Notifiable` trait with this one in your desired notifiable models. For example:

    ```
    use App\Traits\Notifiable;
    ```

    This ensures that your models properly handle trashable notifications.
4. **Routes Registration**: The `routes/resources/notification.php` file is generated as part of the management utilities. You must register this file in your application's built-in `routes/web.php` or `routes/api.php` to make the package routes available. For example, in `routes/api.php`:

    ```
