Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
}
],
"require": {
"php": "8.1.*|8.2.*",
"illuminate/contracts": "^9.0|^10.0",
"livewire/livewire": "^2.0"
"php": "8.1.*|8.2.*|8.3.*",
"illuminate/contracts": "^9.0|^10.0|^11.0",
"livewire/livewire": "^2.0|^3.0"
},
"require-dev": {
"ext-pdo": "*",
"brianium/paratest": "^6.4",
"laravel/pint": "^1.1",
"laravel/pint": "*",
"nunomaduro/collision": "^6.0",
"nunomaduro/larastan": "^2.0",
"orchestra/testbench": "^7.0|^8.0",
Expand Down
2 changes: 1 addition & 1 deletion src/HeadActions/RedirectHeadAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected function icon(): string
public function action(Component $livewire): void
{
$this->openInNewWindow
? $livewire->emit('laraveltable:link:open:newtab', $this->url)
? $livewire->dispatch('laraveltable:link:open:newtab', $this->url)
: redirect()->to($this->url);
}
}
18 changes: 9 additions & 9 deletions src/Livewire/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public function reorder(array $newPositions): void
foreach ($reorderedPositions->sortBy('position') as $reorderedPosition) {
app($modelClass)->find($reorderedPosition['modelKey'])->update([$reorderAttribute => $startOrder++]);
}
$this->emit('laraveltable:action:feedback', __('The list has been reordered.'));
$this->dispatch('laraveltable:action:feedback', __('The list has been reordered.'));
}

public function changeNumberOfRowsPerPage(int $numberOfRowsPerPage): void
Expand Down Expand Up @@ -268,7 +268,7 @@ public function resetFilters(): void
{
$this->selectedFilters = [];
$this->resetFilters = true;
$this->emitSelf('laraveltable:filters:wire:ignore:cancel');
$this->dispatch('laraveltable:filters:wire:ignore:cancel');
}

public function cancelWireIgnoreOnFilters(): void
Expand All @@ -295,7 +295,7 @@ public function bulkAction(string $identifier, bool $requiresConfirmation): mixe
return null;
}
if ($requiresConfirmation) {
return $this->emit(
return $this->dispatch(
'laraveltable:action:confirm',
'bulkAction',
$identifier,
Expand All @@ -305,7 +305,7 @@ public function bulkAction(string $identifier, bool $requiresConfirmation): mixe
}
$feedbackMessage = $bulkActionInstance->getFeedbackMessage();
if ($feedbackMessage) {
$this->emit('laraveltable:action:feedback', $feedbackMessage);
$this->dispatch('laraveltable:action:feedback', $feedbackMessage);
}
$models = app($bulkActionInstance->modelClass)->findMany($bulkActionInstance->allowedModelKeys);

Expand All @@ -325,7 +325,7 @@ public function rowAction(string $identifier, string $modelKey, bool $requiresCo
}
$model = app($rowActionArray['modelClass'])->findOrFail($modelKey);
if ($requiresConfirmation) {
return $this->emit(
return $this->dispatch(
'laraveltable:action:confirm',
'rowAction',
$identifier,
Expand All @@ -335,7 +335,7 @@ public function rowAction(string $identifier, string $modelKey, bool $requiresCo
}
$feedbackMessage = $rowActionInstance->getFeedbackMessage($model);
if ($feedbackMessage) {
$this->emit('laraveltable:action:feedback', $feedbackMessage);
$this->dispatch('laraveltable:action:feedback', $feedbackMessage);
}

return $rowActionInstance->action($model, $this);
Expand All @@ -353,7 +353,7 @@ public function columnAction(string $identifier, string $modelKey, bool $require
}
$model = app($columnActionArray['modelClass'])->findOrFail($modelKey);
if ($requiresConfirmation) {
return $this->emit(
return $this->dispatch(
'laraveltable:action:confirm',
'columnAction',
$identifier,
Expand All @@ -363,7 +363,7 @@ public function columnAction(string $identifier, string $modelKey, bool $require
}
$feedbackMessage = $columnActionInstance->getFeedbackMessage($model, $identifier);
if ($feedbackMessage) {
$this->emit('laraveltable:action:feedback', $feedbackMessage);
$this->dispatch('laraveltable:action:feedback', $feedbackMessage);
}

return $columnActionInstance->action($model, $identifier, $this);
Expand All @@ -375,6 +375,6 @@ public function refresh(array $configParams = [], array $targetedConfigs = []):
return;
}
$this->configParams = [...$this->configParams, ...$configParams];
$this->emitSelf('$refresh');
$this->dispatch('$refresh');
}
}
5 changes: 2 additions & 3 deletions src/RowActions/EditRowAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
namespace Okipa\LaravelTable\RowActions;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\RedirectResponse;
use Livewire\Component;
use Livewire\Redirector;
use Livewire\Features\SupportRedirects\Redirector;
use Okipa\LaravelTable\Abstracts\AbstractRowAction;

class EditRowAction extends AbstractRowAction
Expand Down Expand Up @@ -45,7 +44,7 @@ protected function defaultFeedbackMessage(Model $model): string|null
return null;
}

public function action(Model $model, Component $livewire): RedirectResponse|Redirector
public function action(Model $model, Component $livewire): Redirector
{
return redirect()->to($this->editUrl);
}
Expand Down
2 changes: 1 addition & 1 deletion src/RowActions/RedirectRowAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected function defaultFeedbackMessage(Model $model): string|null
public function action(Model $model, Component $livewire): void
{
$this->openInNewWindow
? $livewire->emit('laraveltable:link:open:newtab', $this->url)
? $livewire->dispatch('laraveltable:link:open:newtab', $this->url)
: redirect()->to($this->url);
}
}
2 changes: 1 addition & 1 deletion src/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public function triggerEventsEmissionOnLoad(Livewire\Table $table): void
foreach ($this->eventsToEmitOnLoad as $event => $params) {
$eventName = is_string($event) ? $event : $params;
$eventParams = is_array($params) ? $params : [];
$table->emit($eventName, $eventParams);
$table->dispatch($eventName, $eventParams);
}
}

Expand Down