app/Console/Commands/LlenaVisitaTerminadaCommand.php
/**
     * Execute the console command.
     *
     * @return mixed
     */
Execute the console command.
@return mixed
Execute the console command . @return mixed
public function handle()
    {
        $visitas = Visita::whereBetween('fecha_fin', [
                            Carbon::now()->subMinutes(180)->toDateTimeString(),
                            Carbon::now()->subMinutes(120)->toDateTimeString()
                        ])
                        ->whereIn('estado_visita_id', [1,2,3,4,5])->get();
        foreach ($visitas as $visita) {
            if ($visita->detalles->count()==0) {
                $visita->vendedor->notify(new LlenaVisitaNotification($visita->id));
            }
        }
    }
public function handle ( ) { $ visitas = Visita :: whereBetween ( 'fecha_fin' , [ Carbon :: now ( ) -> subMinutes ( 180 ) -> toDateTimeString ( ) , Carbon :: now ( ) -> subMinutes ( 120 ) -> toDateTimeString ( ) ] ) -> whereIn ( 'estado_visita_id' , [ 1 , 2 , 3 , 4 , 5 ] ) -> get ( ) ; foreach ( $ visitas as $ visita ) { if ( $ visita -> detalles -> count ( ) == 0 ) { $ visita -> vendedor -> notify ( new LlenaVisitaNotification ( $ visita -> id ) ) ; } } }
Execute the console command.
Execute the console command .