<?php

namespace App\Helpers;

class StrHelper
{

    public static function bindWhereClause($requestValue, $queryField)
    {
        $sql_query = '';
        if ($requestValue != null && !empty($requestValue)) {
            return " AND " . $queryField . " LIKE '%" . $requestValue . "%'";
        } else {
            return '';
        }
    }
    public static function bindWhereDateClause($requestValue, $queryField)
    {
        $sql_query = '';
        if ($requestValue != null && !empty($requestValue)) {
            if ($queryField == 'loan_start_date') {
                return " AND vw.loan_start_date >= TO_DATE('" . $requestValue . "', 'YYYY-MM-DD')";
            }
    
            if ($queryField == 'loan_end_date') {
                return " AND vw.loan_end_date <= TO_DATE('" . $requestValue . "', 'YYYY-MM-DD')";
            }
        } else {
            return '';
        }
    }
}
