misc_pterodactyl-panel/app/Repositories/Concerns/Searchable.php

33 lines
586 B
PHP
Raw Normal View History

<?php
namespace Pterodactyl\Repositories\Concerns;
trait Searchable
{
/**
* The search term to use when filtering results.
*
2020-06-28 15:43:44 -07:00
* @var string|null
2017-07-15 11:52:34 -05:00
*/
protected $searchTerm;
2017-07-15 11:52:34 -05:00
/**
* 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)
2017-07-15 11:52:34 -05:00
{
if (empty($term)) {
return $this;
}
$clone = clone $this;
$clone->searchTerm = $term;
return $clone;
}
}