lundi 12 novembre 2018

Laravel save() show undefined method

i'm new to laravel currently i facing an issue.

I'm trying to insert record to another database, but once i try to save it shows Error:

Call to undefined method Illuminate\Database\Query\Builder::save()

Here is my line of code:

$targetedCustomer = Customer::on($this->connection)->where('fusercode', $user->loginname)->first();
if($targetedCustomer->agent_code != $user->agent)
{
    $targetedCustomer->agent_code = $user->agent;
    $targetedCustomer->save();

    $logs = CustomerAgentCodeUpdateLog::on($this->connection);
    $logs->customer_id =  $targetedCustomer->customer_id;
    $logs->old_agent_code = $targetedCustomer->agent_code;
    $logs->new_agent_code = $user->agent;
    $logs->type = 1;
    $logs->save();
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire