Completed
Push — master ( ac047e...863ff8 )
by Sheela
06:46
created

SendNews::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace SET\Console\Commands;
4
5
use Carbon\Carbon;
6
use Illuminate\Console\Command;
7
use SET\News;
8
9
class SendNews extends Command
10
{
11
    /**
12
     * The name and signature of the console command.
13
     *
14
     * @var string
15
     */
16
    protected $signature = 'emails:news';
17
18
    /**
19
     * The console command description.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Send News Emails on Published Date';
24
25
    public function __construct()
26
    {
27
        parent::__construct();
28
    }
29
30
    /**
31
     * Execute the console command.
32
     *
33
     * @return mixed
34
     */
35
    public function handle()
36
    {
37
        $newsToPublish = News::where('publish_date', Carbon::today())
38
            ->where('send_email', 1)
39
            ->get();
40
41
        foreach ($newsToPublish as $news) {
42
            $news->emailNews();
43
        }
44
    }
45
}
46