Skip to content

Commit

Permalink
Merge pull request #11 from sfneal/dev
Browse files Browse the repository at this point in the history
Nullable `CrudModelAction` $request param
  • Loading branch information
sfneal committed Jun 14, 2021
2 parents 129f82d + d9e7fae commit 959f26a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,7 @@ All notable changes to `crud-model-actions` will be documented in this file

## 0.12.1 - 2021-06-10
- bump sfneal/models min version to v2.3.0 to fix issues with `CrudModelAction` exception throwing


## 0.13.0 - 2021-06-14
- refactor `CrudModelAction`'s $request param to be nullable for actions that don't require request data
6 changes: 3 additions & 3 deletions src/CrudModelAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ abstract class CrudModelAction extends Action
/**
* BaseSaveModelAction constructor.
*
* @param Request $request
* @param Request|null $request
* @param int|EloquentModel|null $model
* @param int|null $related_model_key
*/
public function __construct(Request $request, $model = null, $related_model_key = null)
public function __construct(Request $request = null, $model = null, int $related_model_key = null)
{
$this->request = $request;
$this->request = $request ?? request();
$this->model = $this->resolveModel($model);
$this->related_model_key = $related_model_key;
$this->setTrackingEventFromConfig();
Expand Down
1 change: 1 addition & 0 deletions src/Utils/ResponseMessages.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ protected function successMessage(string $message = null): string
protected function successNoun(string $noun = null): string
{
// todo: add spaces to CamelCase $nouns
// todo: add ID
// Set the success noun if passed
if (isset($noun)) {
$this->successNoun = $noun;
Expand Down

0 comments on commit 959f26a

Please sign in to comment.