PteroTheme/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 23:43:44 +01:00
* @var string|null
2017-07-15 17:52:34 +01:00
*/
protected $searchTerm;
2017-07-15 17:52:34 +01: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 17:52:34 +01:00
{
if (empty($term)) {
return $this;
}
$clone = clone $this;
$clone->searchTerm = $term;
return $clone;
}
}