From 3a9b5ae1d645267e61c0c69bb9ccd20841f9d103 Mon Sep 17 00:00:00 2001 From: Martijn Thomas Date: Thu, 11 Dec 2014 21:07:24 +0100 Subject: [PATCH 1/3] Update readme.md Added the option in the docs to pass an associative array to the Command class with the variables. --- readme.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/readme.md b/readme.md index bd89cc8..6ec63d5 100644 --- a/readme.md +++ b/readme.md @@ -82,6 +82,14 @@ class JobsController extends \BaseController { Notice how we are representing the user's instruction (or command) as a readable class: `PostJobListingCommand`. The `execute` method will expect the command's class path, as a string. Above, we're using the helpful `PostJobListingCommand::class` to fetch this. Alternatively, you could manually write out the path as a string. +You can pass, if you like, the data in an associative array as an second argument: +``` +$this->execute(PostJobListingCommand::class, [ + 'title' => $jobTitle, + 'description' => $description +]); +``` + ### The Command DTO Pretty simply, huh? We make a command to represent the instruction, and then we throw that command into a command bus. From 03b85b65474be87567638f5a77e63e3e395599d5 Mon Sep 17 00:00:00 2001 From: Martijn Thomas Date: Thu, 11 Dec 2014 21:09:01 +0100 Subject: [PATCH 2/3] Update readme.md --- readme.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 6ec63d5..37f2a71 100644 --- a/readme.md +++ b/readme.md @@ -83,12 +83,13 @@ class JobsController extends \BaseController { Notice how we are representing the user's instruction (or command) as a readable class: `PostJobListingCommand`. The `execute` method will expect the command's class path, as a string. Above, we're using the helpful `PostJobListingCommand::class` to fetch this. Alternatively, you could manually write out the path as a string. You can pass, if you like, the data in an associative array as an second argument: -``` + +```php $this->execute(PostJobListingCommand::class, [ 'title' => $jobTitle, 'description' => $description ]); -``` +```php ### The Command DTO From afedb7480bf332fb0dcd5ce0192b6b1cbd3d7d49 Mon Sep 17 00:00:00 2001 From: Martijn Thomas Date: Thu, 11 Dec 2014 21:09:29 +0100 Subject: [PATCH 3/3] Update readme.md --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 37f2a71..28b5e24 100644 --- a/readme.md +++ b/readme.md @@ -89,7 +89,7 @@ $this->execute(PostJobListingCommand::class, [ 'title' => $jobTitle, 'description' => $description ]); -```php +``` ### The Command DTO