Skip to content

Commit

Permalink
[11.x] Allows to disable vendor:publish updating migrations date (#…
Browse files Browse the repository at this point in the history
…50162)

* Allows to not update the migrations date on publish

* fix

* formatting

* formatting

* formatting

---------

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
nunomaduro and taylorotwell committed Feb 21, 2024
1 parent 597f77e commit a10f616
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/Illuminate/Foundation/Console/VendorPublishCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ class VendorPublishCommand extends Command
*/
protected $description = 'Publish any publishable assets from vendor packages';

/**
* Indicates if migration dates should be updated while publishing.
*
* @var bool
*/
protected static $updateMigrationDates = true;

/**
* Create a new command instance.
*
Expand Down Expand Up @@ -341,6 +348,10 @@ protected function createParentDirectory($directory)
*/
protected function ensureMigrationNameIsUpToDate($from, $to)
{
if (static::$updateMigrationDates === false) {
return $to;
}

$from = realpath($from);

foreach (ServiceProvider::publishableMigrationPaths() as $path) {
Expand Down Expand Up @@ -381,4 +392,14 @@ protected function status($from, $to, $type)
$to,
));
}

/**
* Intruct the command to not update the dates on migrations when publishing.
*
* @return void
*/
public static function dontUpdateMigrationDates()
{
static::$updateMigrationDates = false;
}
}

0 comments on commit a10f616

Please sign in to comment.