<?php

namespace App\Repositories\Admin;

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

/**
 * Class LeadStatusRepository
 * @package App\Repositories\Admin
 * @version October 18, 2021, 9:36 pm UTC
 *
 * @method LeadStatus findWithoutFail($id, $columns = ['*'])
 * @method LeadStatus find($id, $columns = ['*'])
 * @method LeadStatus first($columns = ['*'])
*/
class LeadStatusRepository extends BaseRepository
{
    /**
     * @var array
     */
    protected $fieldSearchable = [
        'id',
        'name',
        'created_at'
    ];

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

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

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

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