<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Client extends Model
{
    private $id;
    private $image;
    private $fullnames;
    private $sex;
    private $idcard;
    private $birthdate;
    private $province;
    private $district;
    private $sector;

    public function getId()
    {
        return $this->id;
    }

    public function getImage()
    {
        return $this->image;
    }

    public function getFullnames()
    {
        return $this->fullnames;
    }

    public function getSex()
    {
        return $this->sex;
    }

    public function getIdcard()
    {
        return $this->idcard;
    }

    public function getBirthdate()
    {
        return $this->birthdate;
    }

    public function getProvince()
    {
        return $this->province;
    }

    public function getDistrict()
    {
        return $this->district;
    }

    public function getSector()
    {
        return $this->sector;
    }

    public function setId($id)
    {
        $this->id=$id;
    }

    public function search($name)
    {
        $client = $this->getConnection()->getPdo()->prepare("SELECT * FROM identity WHERE fullnames LIKE '%".$name."%'");
        $client->execute();
        $client->setFetchMode($this->getConnection()->getPdo()::FETCH_CLASS, 'Client');
        $client->fetchAll();
    }
}