app/Console/Commands/MetasDiaSiguienteCommand.php
/**
     * Execute the console command.
     *
     * @return mixed
     */
Execute the console command.
@return mixed
Execute the console command . @return mixed
public function handle()
    {
        $fecha=Carbon::now()->toDateString();
        $metas = Objetivo::where('porcentaje', '<', 100)->where('fecha', Carbon::now()->subDays(1)->toDateString())->get();
        foreach ($metas as $meta) {
            $newMeta = $meta->replicate();
            $newMeta->fecha=$fecha;
            $newMeta->save();
        }
    }
public function handle ( ) { $ fecha = Carbon :: now ( ) -> toDateString ( ) ; $ metas = Objetivo :: where ( 'porcentaje' , '<' , 100 ) -> where ( 'fecha' , Carbon :: now ( ) -> subDays ( 1 ) -> toDateString ( ) ) -> get ( ) ; foreach ( $ metas as $ meta ) { $ newMeta = $ meta -> replicate ( ) ; $ newMeta -> fecha = $ fecha ; $ newMeta -> save ( ) ; } }
Execute the console command.
Execute the console command .