Support the ongoing development of Laravel.io →
Database Eloquent

Actually I am trying to save the same data again in the database. So I retrieved the value from the db and then tried to save it again. But I am getting an error when I call the save function.

    Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_ERROR) 
    Call to undefined method stdClass::save()
    Open: C:\xampp\htdocs\psi-aims\app\models\Orders.php
    public static function updateByOrderId($orderId)
    {
     /**
     *   Copy the Original Row with statusId As INACTIVE and refId AS PRIMARY KEY 
     **/
     $currentOrders = Orders::getForCopy($orderId);
     $currentOrders->mstStatus_id = 2;
     $currentOrders->save();
Last updated 3 years ago.
0

what does "getForCopy" do?

$currentOrders = Orders::getForCopy($orderId);
Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

niriza niriza Joined 18 Sep 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.