Completed
Push — feature/collation ( dfda64...a60b97 )
by Kit Loong
05:53
created

CheckLaravelVersion::atLeastLaravel8()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: liow.kitloong
5
 * Date: 2021/01/02
6
 */
7
8
namespace KitLoong\MigrationsGenerator\Support;
9
10
use Illuminate\Support\Facades\App;
11
12
trait CheckLaravelVersion
13
{
14
    public function atLeastLaravel5Dot7(): bool
15
    {
16
        return $this->atLeastLaravelVersion('5.7.0');
17
    }
18
19
    public function atLeastLaravel5Dot8(): bool
20
    {
21
        return $this->atLeastLaravelVersion('5.8.0');
22
    }
23
24
    public function atLeastLaravel6(): bool
25
    {
26
        return $this->atLeastLaravelVersion('6.0');
27
    }
28
29
    public function atLeastLaravel7(): bool
30
    {
31
        return $this->atLeastLaravelVersion('7.0');
32
    }
33
34
    public function atLeastLaravel8(): bool
35
    {
36
        return $this->atLeastLaravelVersion('8.0');
37
    }
38
39
    private function atLeastLaravelVersion(string $version): bool
40
    {
41
        return version_compare(App::version(), $version, '>=');
42
    }
43
}
44