Skip to content

Commit a10f616

Browse files
[11.x] Allows to disable vendor:publish updating migrations date (#50162)
* Allows to not update the migrations date on publish * fix * formatting * formatting * formatting --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent 597f77e commit a10f616

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/Illuminate/Foundation/Console/VendorPublishCommand.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ class VendorPublishCommand extends Command
6868
*/
6969
protected $description = 'Publish any publishable assets from vendor packages';
7070

71+
/**
72+
* Indicates if migration dates should be updated while publishing.
73+
*
74+
* @var bool
75+
*/
76+
protected static $updateMigrationDates = true;
77+
7178
/**
7279
* Create a new command instance.
7380
*
@@ -341,6 +348,10 @@ protected function createParentDirectory($directory)
341348
*/
342349
protected function ensureMigrationNameIsUpToDate($from, $to)
343350
{
351+
if (static::$updateMigrationDates === false) {
352+
return $to;
353+
}
354+
344355
$from = realpath($from);
345356

346357
foreach (ServiceProvider::publishableMigrationPaths() as $path) {
@@ -381,4 +392,14 @@ protected function status($from, $to, $type)
381392
$to,
382393
));
383394
}
395+
396+
/**
397+
* Intruct the command to not update the dates on migrations when publishing.
398+
*
399+
* @return void
400+
*/
401+
public static function dontUpdateMigrationDates()
402+
{
403+
static::$updateMigrationDates = false;
404+
}
384405
}

0 commit comments

Comments
 (0)