Remove pluck method from update script

This commit is contained in:
Burak Çakırel 2021-01-16 15:47:25 +03:00
parent 75275f5b85
commit 84c0b06cda
No known key found for this signature in database
GPG Key ID: 48FFBB7771B99C7C

View File

@ -134,8 +134,8 @@ class Version210 extends Listener
->where('deleted_at', $invoice->deleted_at) ->where('deleted_at', $invoice->deleted_at)
->where('company_id', $invoice->company_id) ->where('company_id', $invoice->company_id)
->where('type', Document::INVOICE_TYPE) ->where('type', Document::INVOICE_TYPE)
->pluck('id') ->first()
->first(); ->id;
DB::table('credits_transactions') DB::table('credits_transactions')
->where('id', $invoice->credits_transactions_id)->update(['document_id' => $documentId]); ->where('id', $invoice->credits_transactions_id)->update(['document_id' => $documentId]);
@ -159,8 +159,8 @@ class Version210 extends Listener
->where('deleted_at', $credit_note->deleted_at) ->where('deleted_at', $credit_note->deleted_at)
->where('company_id', $credit_note->company_id) ->where('company_id', $credit_note->company_id)
->where('type', self::CREDIT_NOTE_TYPE) ->where('type', self::CREDIT_NOTE_TYPE)
->pluck('id') ->first()
->first(); ->id;
DB::table('credits_transactions') DB::table('credits_transactions')
->where('id', $credit_note->credits_transactions_id)->update(['document_id' => $documentId]); ->where('id', $credit_note->credits_transactions_id)->update(['document_id' => $documentId]);
@ -235,7 +235,7 @@ class Version210 extends Listener
$builder->delete(); $builder->delete();
} }
$documentType = DB::table($new_table)->orderBy('id')->pluck('type')->first(); $documentType = DB::table($new_table)->orderBy('id')->first()->type;
// To be able to update TYPE_id relations // To be able to update TYPE_id relations
$this->addDocumentIdForeignKeys($documentType); $this->addDocumentIdForeignKeys($documentType);
@ -243,7 +243,7 @@ class Version210 extends Listener
// Update relation ids // Update relation ids
DB::table($new_table) DB::table($new_table)
->orderByDesc('id') ->orderByDesc('id')
->increment('id', DB::table($table)->orderByDesc('id')->pluck('id')->first()); ->increment('id', DB::table($table)->orderByDesc('id')->first()->id);
} }
$insertColumns = collect(Schema::getColumnListing($new_table)); $insertColumns = collect(Schema::getColumnListing($new_table));