Shady Hesham
Shady Hesham

Reputation: 55

how to update a column in db with keeping the old content in laravel

I need to update a column with keeping the current content in Laravel using eloquent. I am using the following code to update

        $invoice = Invoice::find($request->input('session_cat_invoice'));
        $invoice->note = $request->input('invoice_note');
        $invoice->save();

column in DB before the update

test1

column in DB after the update using my code

test2

and that we I don't want, what I need is the following

test1 test2

Upvotes: 0

Views: 69

Answers (1)

Jinal Somaiya
Jinal Somaiya

Reputation: 1971

try below code:

$invoice = Invoice::find($request->input('session_cat_invoice'));
$invoice->note = $invoice->note . ' ' . $request->input('invoice_note');
$invoice->save();

Upvotes: 1

Related Questions