evostudio/deactivation

Add deactivation field for Eloquent models

1.2 2022-06-12 20:36 UTC

This package is auto-updated.

Last update: 2024-10-13 02:02:26 UTC


README

This package allows you to add trait (similar to soft deletes) for Laravel Eloquent models.

In our projects we usually use soft deletes for models. When customers delete an object in the application, e.g. in the administration panel, they are usually not interested in whether the record was actually deleted from the table or just marked as deleted by using soft deletes. However, there is often a need to temporarily hide an object, e.g. an article, user or a dictionary entry.

Then we use deactivable trait.

Installation

Install the package via Composer:

$ composer require evostudio/deactivation

The package will automatically register its service provider.

Updating your Eloquent Models

Your models should use the Deactivable trait.

use EvoStudio\Deactivation\Deactivable;

class Client extends Model
{
    use Deactivable;
}