app/Http/Controllers/PendingChangesController.php
public function acceptAllChanges(ServerRequestInterface $request, Tree $tree): ResponseInterface
    {
        $url = $request->get('url', '');

        $changes = DB::table('change')
            ->where('gedcom_id', '=', $tree->id())
            ->where('status', '=', 'pending')
            ->orderBy('change_id')
            ->get();

        foreach ($changes as $change) {
            if (empty($change->new_gedcom)) {
                // delete
                FunctionsImport::updateRecord($change->old_gedcom, $tree, true);
            } else {
                // add/update
                FunctionsImport::updateRecord($change->new_gedcom, $tree, false);
            }

            DB::table('change')
                ->where('change_id', '=', $change->change_id)
                ->update(['status' => 'accepted']);

            Log::addEditLog('Accepted change ' . $change->change_id . ' for ' . $change->xref . ' / ' . $tree->name(), $tree);
        }

        return redirect(route('show-pending', [
            'ged' => $tree->name(),
            'url' => $url,
        ]));
    }
public function acceptAllChanges(ServerRequestInterface $request, Tree $tree): ResponseInterface
    {
        $url = $request->get('url', '');

        $changes = DB::table('change')
            ->where('gedcom_id', '=', $tree->id())
            ->where('status', '=', 'pending')
            ->orderBy('change_id')
            ->get();

        foreach ($changes as $change) {
            if (empty($change->new_gedcom)) {
                // delete
                FunctionsImport::updateRecord($change->old_gedcom, $tree, true);
            } else {
                // add/update
                FunctionsImport::updateRecord($change->new_gedcom, $tree, false);
            }

            DB::table('change')
                ->where('change_id', '=', $change->change_id)
                ->update(['status' => 'accepted']);

            Log::addEditLog('Accepted change ' . $change->change_id . ' for ' . $change->xref . ' / ' . $tree->name(), $tree);
        }

        return redirect(route('show-pending', [
            'ged' => $tree->name(),
            'url' => $url,
        ]));
    }
public function acceptAllChanges ( ServerRequestInterface $ request , Tree $ tree ) : ResponseInterface { $ url = $ request -> get ( 'url' , '' ) ; $ changes = DB :: table ( 'change' ) -> where ( 'gedcom_id' , '=' , $ tree -> id ( ) ) -> where ( 'status' , '=' , 'pending' ) -> orderBy ( 'change_id' ) -> get ( ) ; foreach ( $ changes as $ change ) { if ( empty ( $ change -> new_gedcom ) ) { // delete FunctionsImport :: updateRecord ( $ change -> old_gedcom , $ tree , true ) ; } else { // add/update FunctionsImport :: updateRecord ( $ change -> new_gedcom , $ tree , false ) ; } DB :: table ( 'change' ) -> where ( 'change_id' , '=' , $ change -> change_id ) -> update ( [ 'status' => 'accepted' ] ) ; Log :: addEditLog ( 'Accepted change ' . $ change -> change_id . ' for ' . $ change -> xref . ' / ' . $ tree -> name ( ) , $ tree ) ; } return redirect ( route ( 'show-pending' , [ 'ged' => $ tree -> name ( ) , 'url' => $ url , ] ) ) ; }
Accept all changes to a tree.

@param ServerRequestInterface $request
@param Tree                   $tree

@return ResponseInterface
Accept all changes to a tree .