diff --git a/app/Ship/Parents/Actions/Action.php b/app/Ship/Parents/Actions/Action.php index 98d0538d2..cfcfd5235 100644 --- a/app/Ship/Parents/Actions/Action.php +++ b/app/Ship/Parents/Actions/Action.php @@ -11,11 +11,13 @@ */ abstract class Action { - use CallableTrait; /** - * @var + * Set automatically by the controller after calling an Action. + * Allows the Action to know which UI invoke it, to modify it's behaviour based on it, when needed. + * + * @var string */ protected $ui; diff --git a/app/Ship/Parents/Actions/SubAction.php b/app/Ship/Parents/Actions/SubAction.php new file mode 100644 index 000000000..3ab52897f --- /dev/null +++ b/app/Ship/Parents/Actions/SubAction.php @@ -0,0 +1,13 @@ + + */ +abstract class SubAction extends Action +{ + +} diff --git a/docs/_docs/D.components/subactions.md b/docs/_docs/D.components/subactions.md new file mode 100644 index 000000000..9d16855ac --- /dev/null +++ b/docs/_docs/D.components/subactions.md @@ -0,0 +1,55 @@ +--- +title: "Sub Actions" +category: "Components" +order: 5 +--- + +### Definition & Principles + +Read from the [**Porto SAP Documentation (#SubActions)**](https://github.com/Mahmoudz/Porto#SubActions). + +### Rules + +- All SubActions MUST extend from `App\Ship\Parents\Actions\SubAction`. + +### Folder Structure + +``` + - app + - Containers + - {container-name} + - Actions + - ValidateAddressSubAction.php + - BuildOrderSubAction.php + - ... +``` + +### Code Sample + +**ValidateAddressSubAction User Action:** + +```php +call(ValidateAddressWithEasyPostTask::class, [$recipient]); + + ... + } +} +``` + +**Every feature available for Actions, is also available in SubActions.**