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

39 lines
719 B
PHP
Raw Normal View History

<?php
2017-09-26 02:43:01 +00:00
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
2017-09-26 02:43:01 +00:00
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Repositories\Concerns;
trait Searchable
{
/**
* The term to search.
*
2017-07-15 16:52:34 +00:00
* @var bool|string
*/
protected $searchTerm = false;
/**
* Perform a search of the model using the given term.
*
2017-08-22 03:10:48 +00:00
* @param string $term
* @return $this
*/
2017-07-15 16:52:34 +00:00
public function search($term)
{
if (empty($term)) {
return $this;
}
$clone = clone $this;
$clone->searchTerm = $term;
return $clone;
}
}