<?php
/**
 * Created by PhpStorm.
 * User: 思维定制
 * Date: 2018/10/28
 * Time: 13:46
 */

namespace App\Repositories\Map\Criteria;


use App\Repositories\Base\Criteria;

use App\Repositories\Contracts\RepositoryInterface as Repository;

class MarkWhere extends Criteria
{
    private $search = [];

    /**
     * MultiWhere constructor.
     * @param array $search
     *
     */
    public function __construct(array $search)
    {
        $this->search = $search;
    }

    /**
     * @param $model
     * @param RepositoryInterface $repository
     * @return mixed
     */
    public function apply($model, Repository $repository)
    {
        if(isset($this->search['keyword']) && $this->search['keyword']) {
            $keyword = '%'.$this->search['keyword'].'%';
            $model = $model->where([['title','like',$keyword]]);
        }

        return $model;
    }

}