28 lines
584 B
PHP
28 lines
584 B
PHP
|
<?php
|
||
|
|
||
|
namespace Glmdev\Search;
|
||
|
|
||
|
trait SearchableAgreement {
|
||
|
|
||
|
/**
|
||
|
* returns the searchable fields from the protected $searchable array
|
||
|
*
|
||
|
* @return array
|
||
|
*/
|
||
|
public static function getSearchable(){
|
||
|
$inst = new self();
|
||
|
return $inst->searchable;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* searches the model for the query and returns the results
|
||
|
*
|
||
|
* @param string $query
|
||
|
*
|
||
|
* @return \Illuminate\Support\Collection
|
||
|
*/
|
||
|
public static function search( $query ){
|
||
|
return \Search::search( self::class, $query );
|
||
|
}
|
||
|
|
||
|
}
|