MakeCronTask   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 18
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 8 1
1
<?php
2
3
namespace MadWeb\Initializer\Jobs;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Foundation\Bus\Dispatchable;
7
8
class MakeCronTask
9
{
10
    use Dispatchable, Queueable;
11
12
    /**
13
     * Execute the job.
14
     *
15
     * @return string
16
     */
17
    public function handle()
18
    {
19
        $base_path = base_path();
20
        $task = "* * * * * cd $base_path && php artisan schedule:run >> /dev/null 2>&1";
21
        exec('(crontab -l 2>/dev/null; echo "'.$task.'") | crontab -');
22
23
        return 'Base cron task for scheduling work created. Task: '.$task;
24
    }
25
}
26