Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
lrljoe authored and github-actions[bot] committed Oct 27, 2024
1 parent 3271df3 commit 3659283
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 79 deletions.
153 changes: 77 additions & 76 deletions src/Traits/Core/QueryStrings/HasQueryStringForSort.php
Original file line number Diff line number Diff line change
@@ -1,76 +1,77 @@
<?php

namespace Rappasoft\LaravelLivewireTables\Traits\Core\QueryStrings;

use Livewire\Attributes\Locked;

trait HasQueryStringForSort
{
#[Locked]
public ?bool $queryStringStatusForSort;

protected ?string $queryStringAliasForSort;

protected function queryStringHasQueryStringForSort(): array
{
return ($this->queryStringForSortEnabled() && $this->sortingIsEnabled()) ? ['sorts' => ['except' => null, 'history' => false, 'keep' => false, 'as' => $this->getQueryStringAliasForSort()]] : [];

}
public function setupQueryStringStatusForSort(): void
{
if (! $this->hasQueryStringStatusForSort()) {
$this->setQueryStringForSortEnabled();
}
}

public function hasQueryStringStatusForSort(): bool
{
return isset($this->queryStringStatusForSort);
}

public function getQueryStringStatusForSort(): bool
{
return $this->queryStringStatusForSort ?? true;
}

public function queryStringForSortEnabled(): bool
{
$this->setupQueryStringStatusForSort();

return $this->getQueryStringStatusForSort() && $this->sortingIsEnabled();
}

public function setQueryStringStatusForSort(bool $status): self
{
$this->queryStringStatusForSort = $status;

return $this;
}

public function setQueryStringForSortEnabled(): self
{
return $this->setQueryStringStatusForSort(true);
}

public function setQueryStringForSortDisabled(): self
{
return $this->setQueryStringStatusForSort(false);
}

public function hasQueryStringAliasForSort(): bool
{
return isset($this->queryStringAliasForSort);
}

public function getQueryStringAliasForSort(): string
{
return $this->queryStringAliasForSort ?? $this->getQueryStringAlias().'-sorts';
}

public function setQueryStringAliasForSort(string $alias): self
{
$this->queryStringAliasForSort = $alias;

return $this;
}
}
<?php

namespace Rappasoft\LaravelLivewireTables\Traits\Core\QueryStrings;

use Livewire\Attributes\Locked;

trait HasQueryStringForSort
{
#[Locked]
public ?bool $queryStringStatusForSort;

protected ?string $queryStringAliasForSort;

protected function queryStringHasQueryStringForSort(): array
{
return ($this->queryStringForSortEnabled() && $this->sortingIsEnabled()) ? ['sorts' => ['except' => null, 'history' => false, 'keep' => false, 'as' => $this->getQueryStringAliasForSort()]] : [];

}

public function setupQueryStringStatusForSort(): void
{
if (! $this->hasQueryStringStatusForSort()) {
$this->setQueryStringForSortEnabled();
}
}

public function hasQueryStringStatusForSort(): bool
{
return isset($this->queryStringStatusForSort);
}

public function getQueryStringStatusForSort(): bool
{
return $this->queryStringStatusForSort ?? true;
}

public function queryStringForSortEnabled(): bool
{
$this->setupQueryStringStatusForSort();

return $this->getQueryStringStatusForSort() && $this->sortingIsEnabled();
}

public function setQueryStringStatusForSort(bool $status): self
{
$this->queryStringStatusForSort = $status;

return $this;
}

public function setQueryStringForSortEnabled(): self
{
return $this->setQueryStringStatusForSort(true);
}

public function setQueryStringForSortDisabled(): self
{
return $this->setQueryStringStatusForSort(false);
}

public function hasQueryStringAliasForSort(): bool
{
return isset($this->queryStringAliasForSort);
}

public function getQueryStringAliasForSort(): string
{
return $this->queryStringAliasForSort ?? $this->getQueryStringAlias().'-sorts';
}

public function setQueryStringAliasForSort(string $alias): self
{
$this->queryStringAliasForSort = $alias;

return $this;
}
}
5 changes: 2 additions & 3 deletions src/Traits/WithSorting.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
use Illuminate\Support\Collection;
use Livewire\Attributes\Locked;
use Rappasoft\LaravelLivewireTables\Traits\Configuration\SortingConfiguration;
use Rappasoft\LaravelLivewireTables\Traits\Helpers\SortingHelpers;
use Rappasoft\LaravelLivewireTables\Traits\Core\QueryStrings\HasQueryStringForSort;
use Rappasoft\LaravelLivewireTables\Traits\Helpers\SortingHelpers;

trait WithSorting
{
use SortingConfiguration,
SortingHelpers;
use HasQueryStringForSort;

public array $sorts = [];

public Collection $sortableColumns;
Expand All @@ -33,7 +33,6 @@ trait WithSorting

public string $defaultSortingLabelDesc = 'Z-A';


public function sortBy(string $columnSelectName): ?string
{

Expand Down

0 comments on commit 3659283

Please sign in to comment.