<?php

namespace App\Repositories\Admin;

use App\Models\LeadHistory;
use InfyOm\Generator\Common\BaseRepository;

/**
 * Class LeadHistoryRepository
 * @package App\Repositories\Admin
 * @version October 29, 2021, 12:04 pm UTC
 *
 * @method LeadHistory findWithoutFail($id, $columns = ['*'])
 * @method LeadHistory find($id, $columns = ['*'])
 * @method LeadHistory first($columns = ['*'])
 */
class LeadHistoryRepository extends BaseRepository
{
    /**
     * @var array
     */
    protected $fieldSearchable = [
        'lead_id',
        'changed_by_id',
        'status',
        'discription',
        'created_at',
        'updated_at'
    ];

    /**
     * Configure the Model
     **/
    public function model()
    {
        return LeadHistory::class;
    }

    /**
     * @param $request
     * @return mixed
     */
    public function saveRecord($input)
    {
//        $input = $request->all();
        $leadHistory = $this->create($input);
        return $leadHistory;
    }

    /**
     * @param $request
     * @param $leadHistory
     * @return mixed
     */
    public function updateRecord($request, $leadHistory)
    {
        $input       = $request->all();
        $leadHistory = $this->update($input, $leadHistory->id);
        return $leadHistory;
    }

    /**
     * @param $id
     * @return mixed
     */
    public function deleteRecord($id)
    {
        $leadHistory = $this->delete($id);
        return $leadHistory;
    }
}
