Laravel: Check with WhereBetween

1

I want to adapt a query I had with a simple Where, using a Where in conjunction with a Between, to make a query with a range between two dates. My code is like this. And I'm aware that the "whereBetween" is not working.

$consulta = DB::table('Empleados as E')
                    ->select(DB::raw('concat(E.nombre, " ", E.apellido_paterno," ", E.apellido_materno) as nombre'))
                    ->whereNotIn('E.id', function($query)
                    {
                        $min = '2016-08-01';
                        $max = '2016-08-08';
                        $query->select('Empleados_id')
                                    ->from('Entrada_regular as er')
                                    ->whereBetween('er.fecha',array($min, $max));
                    })
                    ->whereNotIn('E.id', function($query)
                    {
                        $min = '2016-08-01';
                        $max = '2016-08-08';
                        $query->select('Empleados_id')
                                    ->from('Entrada_tarde as et')
                                    ->whereBetween('et.fecha', array($min, $max));
                    })
                    ->get();
                return $consulta;

I need to know how to put a where with a between the way I do that query.

    
asked by YelloWhale 11.08.2016 в 05:19
source

0 answers