samedi 22 juin 2019

How to make this SQL query in Laravel

I have this query that works well, but how do I do it in Laravel?

SELECT * FROM IGNom_Trabajador 
    WHERE REPLACE(CODE, '.', '') = 12345678

I've tried the following statements, but they don't work.

$user = DB
    ::connection('sqlsrv')
    ->select(DB::raw(
        'SELECT * FROM IGNom_Trabajdor WHERE REPLACE(CODE, ".", "") = $auth->ci'
    ));

$user = Employee
    ::where(/DB::raw(REPLACE('CODE', '.', ''), '=', '24883967')
    ->first();



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire