DatabaseServiceProvider::migrations()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Jumilla\Versionia\Laravel\Support;
4
5
use Illuminate\Support\ServiceProvider;
6
use Jumilla\Versionia\Laravel\Migrator;
7
8
abstract class DatabaseServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Register the service provider.
12
     */
13 1
    public function register()
14
    {
15 1
    }
16
17
    /**
18
     * @param string $group
19
     * @param string $version
20
     * @param string $class
21
     */
22 2
    protected function migration($group, $version, $class)
23
    {
24 2
        $this->app['database.migrator']->registerMigration($group, $version, $class);
25 2
    }
26
27
    /**
28
     * @param string $group
29
     * @param array  $versions
30
     */
31 1
    protected function migrations($group, array $versions)
32
    {
33 1
        $this->app['database.migrator']->registerMigrations($group, $versions);
34 1
    }
35
36
    /**
37
     * @param string $name
38
     * @param string $class
39
     * @param bool   $is_default
40
     */
41 1
    protected function seed($name, $class, $is_default = false)
42
    {
43 1
        $this->app['database.migrator']->registerSeed($name, $class);
44
45 1
        if ($is_default) {
46 1
            $this->app['database.migrator']->setDefaultSeed($name);
47
        }
48 1
    }
49
50
    /**
51
     * @param array       $seeds
52
     * @param bool|string $default
53
     */
54 1
    protected function seeds(array $seeds, $default = null)
55
    {
56 1
        $this->app['database.migrator']->registerSeeds($seeds);
57
58 1
        if ($default === true) {
59 1
            $default = array_keys($seeds)[0];
60
        }
61
62 1
        $this->app['database.migrator']->setDefaultSeed($default);
63 1
    }
64
}
65