Update all remaining code pathways to use new search tooling
This commit is contained in:
parent
12fe3f1a4e
commit
d8c338df3e
14 changed files with 54 additions and 305 deletions
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Repositories\Concerns;
|
||||
|
||||
trait Searchable
|
||||
{
|
||||
/**
|
||||
* The search term to use when filtering results.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $searchTerm;
|
||||
|
||||
/**
|
||||
* Set the search term to use when requesting all records from
|
||||
* the model.
|
||||
*
|
||||
* @param string|null $term
|
||||
* @return $this
|
||||
*/
|
||||
public function setSearchTerm(string $term = null)
|
||||
{
|
||||
if (empty($term)) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$clone = clone $this;
|
||||
$clone->searchTerm = $term;
|
||||
|
||||
return $clone;
|
||||
}
|
||||
}
|
|
@ -82,16 +82,6 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa
|
|||
})->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all available nodes with a searchable interface.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
|
||||
*/
|
||||
public function getNodeListingData(): LengthAwarePaginator
|
||||
{
|
||||
return $this->getBuilder()->with('location')->withCount('servers')->paginate(25, $this->getColumns());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a single node with location and server information.
|
||||
*
|
||||
|
|
|
@ -22,17 +22,6 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
|
|||
return Server::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a listing of all servers that exist including relationships.
|
||||
*
|
||||
* @param int $paginate
|
||||
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
|
||||
*/
|
||||
public function getAllServers(int $paginate): LengthAwarePaginator
|
||||
{
|
||||
return $this->getBuilder()->with('node', 'user', 'allocation')->paginate($paginate, $this->getColumns());
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the egg relations onto the server model.
|
||||
*
|
||||
|
|
|
@ -19,16 +19,6 @@ class UserRepository extends EloquentRepository implements UserRepositoryInterfa
|
|||
return User::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all users with counts of servers and subusers of servers.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
|
||||
*/
|
||||
public function getAllUsersWithCounts(): LengthAwarePaginator
|
||||
{
|
||||
return $this->getBuilder()->withCount('servers')->paginate(50, $this->getColumns());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all matching models for a user in a format that can be used for dropdowns.
|
||||
*
|
||||
|
|
Reference in a new issue