Skip to content

Releases: thefeqy/laravel-model-status

v1.5.0

04 Mar 14:54
Compare
Choose a tag to compare

[v1.5.0] - 2025-03-04

New Features

  • Status Casting (StatusCast)

    • The status field is now automatically cast to a Status object.
    • Allows method calls like $model->status->isActive() and $model->status->isInactive().
    • Ensures better type safety when working with statuses.
  • Cascade Deactivation

    • When a model is deactivated, related models can also be automatically deactivated.
    • Introduced $cascadeDeactivate property to define related models that should also be deactivated.
    • Example:
      class Category extends Model
      {
          use HasActiveScope;
      
          protected array $cascadeDeactivate = ['products'];
      
          public function products()
          {
              return $this->hasMany(Product::class);
          }
      }
    • Calling $category->deactivate(); will also deactivate all associated products.

Upgrade Guide

To update to v1.5.0, run:

composer update thefeqy/laravel-model-status

Full Changelog: v1.4.0...v1.5.0

v1.4.0

01 Mar 13:13
Compare
Choose a tag to compare

[v1.4.0] - 2025-03-01

Enhancements

  • Added active() scope to retrieve only active models
  • Added inActive() scope to retrieve only inactive models
  • Deprecated withActive() scope and replace it with active() scope directly to maintain naming convention

Full Changelog: 1.3.0...v1.4.0

v1.3.0 - Support Laravel 12

26 Feb 13:13
Compare
Choose a tag to compare

[v1.3.0] - 2025-02-26

  • Added support for Laravel 12
  • Added support for PHP 8.4
  • Drop support for Laravel 10

v1.2.1

22 Feb 14:09
Compare
Choose a tag to compare

[v1.2.1] - 2025-02-22

🚀 Enhancements

  • Added withActiveScope to retrieve only active models

v1.2.0

17 Feb 20:21
Compare
Choose a tag to compare

[v1.2.0] - 2025-02-17

🚀 Enhancements

  • Added a local installation command (php artisan model-status:install) to publish config and set up .env keys.
  • Implemented an admin bypass feature to allow admins to see all models without using withoutActive().
  • Added support for dynamic status values in the Status class (removes dependency on static enums).

🛠 Fixes & Improvements

  • Fixed missing User model in tests by creating a FakeUser model implementing Authenticatable.
  • Refactored tests to use Orchestra Testbench correctly, ensuring package isolation from Laravel core.

📝 Documentation Updates

  • Updated README.md with new features and admin bypass details.
  • Added CONTRIBUTING.md to guide contributors through setup, testing, and PR submission.
  • Updated test coverage to validate activate() and deactivate() model methods.