dimanche 19 septembre 2021

WHERE and CONCAT columns with Dateformat (Year-month-) and string with Laravel 8

I need the column date and digits to concatenate. The date should be YY-mm format and the digits should have a leading zero.

Example output

21-09-0001

How to do it in WHERE FUNCTION laravel eloquent? like this. I found this on the internet

example:

public function scopeFindDVNumber($query,$name) {
    $query->where(DB::raw(
            "REPLACE(
                    COALESCE(name_first,''),' ',
                    COALESCE(name_middle,''),' ',
                    COALESCE(name_last,'')
                ),
            '  ',' ')"
        ),
    'like', '%' . $name . '%');
}

I don't know how to do it and I need it for search function. Thank you in advance



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire