<?php
namespace App\Searches;
use Request;
abstract class Searches
{
/**
* The number of results per page.
*
* @var int
*/
protected $per_page = 15;
/**
* The keyword(s) of search term.
*
* @var string
*/
protected $keywords = '';
/**
* The model which needs to search.
*
* @var Model
*/
protected $model;
/**
* The additional options needs to build an advance query.
*
* @var object
*/
protected $options;
/**
* Set the model which needs to search in.
*
* @param Eloquent model
*/
public function in($model)
{
$this->model = $model;
return $this;
}
/**
* Set the search keywords.
*
* @param string
*/
public function search($keywords)
{
$this->keywords = $keywords;
return $this;
}
/**
* Set the number of results per a page.
*
* @param int
*/
public function paginate($per_page)
{
$this->per_page = $per_page;
return $this;
}
/**
* Set the options.
*
* @param object
*/
public function option($options)
{
$this->options = $options;
return $this;
}
abstract public function get();
}