@@ -50,59 +50,61 @@ Laravel Zero provides a main command. That is the default one of your applicatio
50
50
51
51
Let's take a look at an example command.
52
52
53
- <?php
54
-
55
- namespace App\Console\Commands;
53
+ ``` php
54
+ <?php
55
+
56
+ namespace App\Console\Commands;
57
+
58
+ use App\DripEmailer;
59
+ use Illuminate\Console\Command;
60
+
61
+ class SendEmails extends Command
62
+ {
63
+ /**
64
+ * The name and signature of the console command.
65
+ *
66
+ * @var string
67
+ */
68
+ protected $signature = 'email:send {email}';
69
+
70
+ /**
71
+ * The console command description.
72
+ *
73
+ * @var string
74
+ */
75
+ protected $description = 'Send drip e-mails to a email';
76
+
77
+ /**
78
+ * The drip e-mail service.
79
+ *
80
+ * @var DripEmailer
81
+ */
82
+ protected $drip;
83
+
84
+ /**
85
+ * Create a new command instance.
86
+ *
87
+ * @param DripEmailer|null $drip
88
+ * @return void
89
+ */
90
+ public function __construct(DripEmailer $drip = null)
91
+ {
92
+ parent::__construct();
56
93
57
- use App\ DripEmailer;
58
- use Illuminate\Console\Command;
94
+ $this->drip = $drip ?: new DripEmailer;
95
+ }
59
96
60
- class SendEmails extends Command
97
+ /**
98
+ * Execute the console command.
99
+ *
100
+ * @return mixed
101
+ */
102
+ public function handle()
61
103
{
62
- /**
63
- * The name and signature of the console command.
64
- *
65
- * @var string
66
- */
67
- protected $signature = 'email:send {email}';
68
-
69
- /**
70
- * The console command description.
71
- *
72
- * @var string
73
- */
74
- protected $description = 'Send drip e-mails to a email';
75
-
76
- /**
77
- * The drip e-mail service.
78
- *
79
- * @var DripEmailer
80
- */
81
- protected $drip;
82
-
83
- /**
84
- * Create a new command instance.
85
- *
86
- * @param DripEmailer|null $drip
87
- * @return void
88
- */
89
- public function __construct(DripEmailer $drip = null)
90
- {
91
- parent::__construct();
92
-
93
- $this->drip = $drip ?: new DripEmailer;
94
- }
95
-
96
- /**
97
- * Execute the console command.
98
- *
99
- * @return mixed
100
- */
101
- public function handle()
102
- {
103
- $this->drip->send($this->argument('email'));
104
- }
104
+ $this->drip->send($this->argument('email'));
105
105
}
106
+ }
107
+ ```
106
108
107
109
You may review the documentation of the Artisan Console component [ on Laravel Official Website] ( https://laravel.com/docs/5.4/artisan ) .
108
110
0 commit comments