Skip to content

Releases: lorisleiva/laravel-actions

v1.1.5

17 Oct 14:14
aed0e62
Compare
Choose a tag to compare

🚑 Fixes ignored default values in handle method (#66)

v1.1.4

13 Sep 17:43
Compare
Choose a tag to compare

🚑 Bug fix

v1.1.3

13 Sep 16:46
94cf98a
Compare
Choose a tag to compare

⬆️ Add support for Laravel 8

v1.1.2

14 Aug 09:06
ea9d021
Compare
Choose a tag to compare

📝 Use expectsJson instead of wantsJson to determine if we should use jsonResponse for Actions as controllers.

v1.1.1

10 Jun 13:05
bccbc78
Compare
Choose a tag to compare

🖼 Fix paths on Windows (667fe74)

v1.1.0

23 May 12:43
Compare
Choose a tag to compare

This release slightly adjusts the dependency injection logic by supporting nullable typehints. Let's go through a few examples to understand what that really means.

A) Optional injections

Assuming $service is not an attribute of this action, prior to this version, it would have resolved the MyInjectedService class from the container even though it's an optional typehint (notice the ? prefix). Now, it will not even try to resolve it from the container. This mechanism can be helpful to turn dependency injection off for certain arguments.

class MyAction extends Action
{
    public function handle(?MyInjectedService $service)
    {
        // ...
    }
};

The reason behind this change is to make sure Laravel Actions does not try to become too intrusive when resolving the arguments of your methods.

B) Optional route bindings

Consider the example below where the User model is typehinted but marked as nullable. Prior to this version, Laravel Actions would have thrown an exception if the provided user identifier did not successfully retrieve a user from the database. Now, it will return null instead of throwing an exception if the user cannot be found via the provided identifier.

class MyAction extends Action
{
    public function handle(?User $user)
    {
        // if $user is "1" and User::find(1) exists, it returns the fetched model.
        // if $user is "42" and User::find(42) does not exist, it returns null instead of throwing an exception
        // if $user is null, it returns null instead of throwing an exception
    }
};

The reason behind this change is to allow a more flexible route model binding.


Whilst these changes can break some existing code (hence the jump to 1.1) it is very unlikely that it will. Chances are, if you were marking a typehint as nullable before, you were already planning for that argument to be null.

v1.0.4

22 May 11:03
Compare
Choose a tag to compare

📝 Add controllerMiddleware method to avoid conflicts with job middleware. If the controllerMiddleware is not provided, it falls back to using middleware to avoid breaking changes.

v1.0.3

21 May 16:28
Compare
Choose a tag to compare

🤝 Add support for custom implicit route bindings (e.g. /articles/{article:slug}) and nested route bindings (e.g. /users/{users}/articles/{article:slug}) for Laravel 7 only (see Laravel documentation).

v1.0.2

17 May 21:35
Compare
Choose a tag to compare

Make handle method optional. This allows for actions acting as pure authorisation or validation guards as well as actions that simply need a response method to render some view. (See #39)

v1.0.1

10 May 17:04
Compare
Choose a tag to compare

Adjust PHPStorm annotations to allow for custom getAttributeFromConstructor logic.