src/Model/BaseModel.php
public static function getIdByField($field, $value)
    {
        $result = self::find()->where([$field => $value])->limit(1)->one();
        return ($result) ? $result->id : null;
    }
public static function getIdByField($field, $value)
    {
        $result = self::find()->where([$field => $value])->limit(1)->one();
        return ($result) ? $result->id : null;
    }
Returns the Model Id based on the field value
@author Adeyemi Olaoye <yemi@cottacush.com>
@param $field
@param $value
@return self | null