Skip to content

Commit

Permalink
Update upgrade command
Browse files Browse the repository at this point in the history
  • Loading branch information
PhiloNL committed Jul 30, 2023
1 parent 7e9f7a8 commit b2996e3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/WireElementsModalUpgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@ public function handle(UpgradeCommand $console, \Closure $next)
{
$this->interactiveReplacement(
console: $console,
title: 'The $dispatch helper expects named parameters.',
title: 'The $dispatch helper expects named arguments.',
before: '$dispatch(\'openModal\', \'component-name\', {user: 1})',
after: '$dispatch(\'openModal\', {component: \'component-name\', parameters: {user: 1}})',
after: '$dispatch(\'openModal\', {component: \'component-name\', arguments: {user: 1}})',
pattern: '/\$(?:dispatch|emit)\(\'openModal\', \'([^\']+)\'(?:, (\{[^}]+\}|@js\(\[[^\]]+\]\)))?\)/',
replacement: function($matches) {
$component = $matches[1];
$params = isset($matches[2]) ? ', parameters: ' . $matches[2] : '';
$params = isset($matches[2]) ? ', arguments: ' . $matches[2] : '';
return "\$dispatch('openModal', {component: '$component'$params})";
},
directories: 'resources'
);

$this->interactiveReplacement(
console: $console,
title: 'The Livewire.dispatch helper expects named parameters.',
title: 'The Livewire.dispatch helper expects named arguments.',
before: 'Livewire.dispatch(\'openModal\', \'component-name\', {user: 1})',
after: 'Livewire.dispatch(\'openModal\', {component: \'component-name\', parameters: {user: 1}})',
after: 'Livewire.dispatch(\'openModal\', {component: \'component-name\', arguments: {user: 1}})',
pattern: '/Livewire.(?:dispatch|emit)\(\'openModal\', \'([^\']+)\'(?:, (\{[^}]+\}|@js\(\[[^\]]+\]\)))?\)/',
replacement: function($matches) {
$component = $matches[1];
$params = isset($matches[2]) ? ', parameters: ' . $matches[2] : '';
$params = isset($matches[2]) ? ', arguments: ' . $matches[2] : '';
return "Livewire.dispatch('openModal', {component: '$component'$params})";
},
directories: 'resources'
Expand Down

0 comments on commit b2996e3

Please sign in to comment.