mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-05-08 04:00:14 -05:00
Reapply "Merge pull request #3380 from Roardom/livewire-types"
This reverts commit b4a9dfea8b.
This commit is contained in:
@@ -15,11 +15,13 @@ namespace App\Http\Livewire;
|
||||
|
||||
use App\Models\History;
|
||||
use App\Models\User;
|
||||
use App\Traits\LivewireSort;
|
||||
use Livewire\Component;
|
||||
use Livewire\WithPagination;
|
||||
|
||||
class UserTorrents extends Component
|
||||
{
|
||||
use LivewireSort;
|
||||
use WithPagination;
|
||||
|
||||
public ?User $user = null;
|
||||
@@ -44,14 +46,20 @@ class UserTorrents extends Component
|
||||
|
||||
public string $downloaded = 'any';
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public array $status = [];
|
||||
|
||||
public string $sortField = 'created_at';
|
||||
|
||||
public string $sortDirection = 'desc';
|
||||
|
||||
public $showMorePrecision = false;
|
||||
public bool $showMorePrecision = false;
|
||||
|
||||
/**
|
||||
* @var array<mixed>
|
||||
*/
|
||||
protected $queryString = [
|
||||
'perPage' => ['except' => ''],
|
||||
'name' => ['except' => ''],
|
||||
@@ -84,6 +92,9 @@ class UserTorrents extends Component
|
||||
$this->resetPage();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator<History>
|
||||
*/
|
||||
final public function getHistoryProperty(): \Illuminate\Contracts\Pagination\LengthAwarePaginator
|
||||
{
|
||||
return History::query()
|
||||
@@ -169,15 +180,4 @@ class UserTorrents extends Component
|
||||
'histories' => $this->history,
|
||||
]);
|
||||
}
|
||||
|
||||
final public function sortBy($field): void
|
||||
{
|
||||
if ($this->sortField === $field) {
|
||||
$this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
|
||||
} else {
|
||||
$this->sortDirection = 'asc';
|
||||
}
|
||||
|
||||
$this->sortField = $field;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user