Total Complexity | 3 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | class Migration extends Model |
||
13 | { |
||
14 | protected $table = 'migrations'; |
||
15 | protected $fillable = ['migration', 'batch']; |
||
16 | |||
17 | public static function getLastBatch() |
||
18 | { |
||
19 | $instance = new static; |
||
20 | |||
21 | if (!Capsule::schema()->hasTable($instance->getTable())) { |
||
22 | static::createTable(); |
||
23 | } |
||
24 | |||
25 | return static::max('batch') ?? 0; |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * Create the migration table if it does not exist. |
||
30 | * |
||
31 | * @return void |
||
32 | */ |
||
33 | private static function createTable() |
||
40 | }); |
||
41 | } |
||
44 |