Skip to content

Releases: cleaniquecoders/laravel-action

2.1.2

01 Nov 02:45
Compare
Choose a tag to compare

What's Changed

  • 📝 Update Changelog by @github-actions in #21

Full Changelog: 2.1.1...2.1.2

2.1.1

01 Nov 02:41
Compare
Choose a tag to compare

What's Changed

  • 📝 Update Changelog by @github-actions in #20

New Contributors

  • @github-actions made their first contribution in #20

Full Changelog: 2.1.0...2.1.1

2.1.0

31 Oct 17:55
Compare
Choose a tag to compare

Release Notes for Version 2.1.0

Full Changelog: 2.0.0...2.1.0

Overview

Version 2.1.0 introduces improved flexibility and power to the Laravel Actionable package. By integrating the lorisleiva/laravel-actions package, this release allows actions to be used in various execution contexts.

Key Changes

Integration with lorisleiva/laravel-actions

  • Multi-Context Execution: Actions can now be used as controllers, jobs, or event listeners, thanks to the AsAction trait from lorisleiva/laravel-actions.
  • Standardized handle() Method: The main action logic is now defined in the handle() method instead of execute(), allowing seamless use in different contexts and aligning with Laravel's conventions.

Upgrade Notes

  • Migration from execute() to handle():
    • If you previously used the execute() method to run actions, update your code to use the handle() method. This change aligns with Laravel conventions and the lorisleiva/laravel-actions integration.

Installation and Testing

To upgrade, update the package using Composer:

composer update cleaniquecoders/laravel-action

Run the tests with:

composer test

2.0.0

31 Oct 16:41
Compare
Choose a tag to compare

Version 2.0 marks a new major release of the ResourceAction class, introducing enhanced flexibility, field transformation, and constraint handling, along with improvements in naming and structure. This release requires some upgrade changes for existing implementations.

Full Changelog: 1.6.0...2.0.0


Major Changes

  • Class Rename from AbstractAction to ResourceAction:
    • The foundational abstract class has been renamed from AbstractAction to ResourceAction to better reflect its purpose and usage in handling resources.
    • Upgrade Note: Update all references in your codebase to ResourceAction:
      use CleaniqueCoders\LaravelAction\ResourceAction;
    • Example Upgrade:
      - use CleaniqueCoders\LaravelAction\AbstractAction;
      + use CleaniqueCoders\LaravelAction\ResourceAction;

New Features and Improvements

  • Flexible Property Setter:

    • Introduced a generic setProperty method to dynamically set properties like hashFields, encryptFields, and constrainedBy, reducing code duplication and improving maintainability.
    • Previous Usage:
      $action->setHashFields(['password']);
      $action->setEncryptFields(['ssn']);
      $action->setConstrainedBy(['email' => 'johndoe@example.com']);
    • New Usage:
      $action->setProperty('hashFields', ['password']);
      $action->setProperty('encryptFields', ['ssn']);
      $action->setProperty('constrainedBy', ['email' => 'johndoe@example.com']);
    • Benefits: This update allows developers to set class properties dynamically and flexibly, streamlining the syntax and reducing boilerplate code.
  • Field Transformation with Hashing and Encryption:

    • Added support for specifying fields that require hashing and encryption, with the ability to apply both transformations independently or in combination on selected fields.
    • Example Usage:
      $inputs = [
          'name' => 'Jane Doe',
          'email' => 'janedoe@example.com',
          'password' => 'securepassword',
          'ssn' => '123-45-6789',
      ];
      
      $action = new CreateUserAction($inputs);
      $action->setProperty('hashFields', ['password']);
      $action->setProperty('encryptFields', ['ssn']);
      $record = $action->execute();
      
      // Results:
      // - 'password' field will be hashed using bcrypt.
      // - 'ssn' field will be encrypted for security.
    • Benefits: This feature provides fine-grained control over sensitive data, allowing selective application of security measures for each field.
  • Enhanced Test Suite:

    • A comprehensive suite of tests now covers essential scenarios, including:
      • Basic data creation and required field validation.
      • Applying multiple transformations with hashing and encryption on specific fields.
      • Using constraints to test updateOrCreate functionality, supporting scenarios like identifying records by id for unique constraint tests.
      • Conditional transformation to skip optional fields when they’re missing from inputs.
      • Validating transaction usage to confirm atomicity during execution.
    • Example of updateOrCreate with Constraints:
      // Initial user creation with a unique constraint on 'email'.
      $existingUser = User::create([
          'name' => 'Old Name',
          'email' => 'uniqueemail@example.com',
          'password' => Hash::make('oldpassword'),
      ]);
      
      // Update the existing user by constraining on 'id'.
      $inputs = [
          'name' => 'John Doe Updated',
          'email' => 'uniqueemail@example.com',
          'password' => 'newpassword',
      ];
      
      $action = new CreateUserAction($inputs);
      $action->setProperty('constrainedBy', ['id' => $existingUser->id]); // Use ID as a constraint for updating
      
      $record = $action->execute();
      
      // Expected result:
      // - The existing user record with the specified 'id' will be updated with new data.
    • Benefits: The updated test suite ensures that key functionality is covered and validated, making the ResourceAction class highly reliable and secure in various scenarios.

Summary of Benefits

This release delivers major improvements in flexibility, maintainability, and security within the ResourceAction class. By supporting dynamic property setting, targeted data transformations, and reliable constraint handling, Version 2.0 is positioned for robust, secure applications.

Upgrade Notes

  • Update Class Name: Replace all references to AbstractAction with ResourceAction in your codebase.
  • Test and Verify: If you have custom implementations extending the AbstractAction class, ensure they are updated to use the new ResourceAction class and test thoroughly.

Improve code readability and added unit test.

10 Oct 01:12
Compare
Choose a tag to compare

What's Changed

  • Bump aglipanci/laravel-pint-action from 2.3.1 to 2.4 by @dependabot in #16

Full Changelog: 1.4.0...2.0.0

What's Changed

  • Bump aglipanci/laravel-pint-action from 2.3.1 to 2.4 by @dependabot in #16

Full Changelog: 1.4.0...1.6.0

Added Laravel 11 Support

21 Mar 04:01
Compare
Choose a tag to compare

1.4.0

21 Mar 03:59
Compare
Choose a tag to compare

What's Changed

  • Bump aglipanci/laravel-pint-action from 2.1.0 to 2.3.1 by @dependabot in #13

Full Changelog: 1.3.0...1.4.0

1.3.0

03 Dec 07:19
f548f90
Compare
Choose a tag to compare

Migrate from Bekwoh to Cleanique Coders

What's Changed

New Contributors

Full Changelog: 1.2.0...1.3.0

1.2.0

25 Feb 01:29
Compare
Choose a tag to compare

What's Changed

  • Bump dependabot/fetch-metadata from 1.3.3 to 1.3.4 by @dependabot in #1
  • Bump dependabot/fetch-metadata from 1.3.4 to 1.3.5 by @dependabot in #2

New Contributors

Full Changelog: 1.1.3...1.2.0

1.1.3

17 Sep 15:31
Compare
Choose a tag to compare

Full Changelog: 1.1.2...1.1.3