Support the ongoing development of Laravel.io →
posted 7 years ago
Eloquent

class Order extends Model
{
    public function sms()
    {
        return $this->belongsToMany('App\Sms')->using('App\OrderSms')->withTimestamps();
    }
}

class Sms extends Model
{
    public $timestamps = false;

    protected $fillable = ['subject', 'template'];
}

class OrderSms extends Pivot
{
    protected $table = 'order_sms';
}

OrderSms::where('red_sms_id', $smsId)->update([
    'status' => $status
]);

As result is Call to a member function getUpdatedAtColumn() on null. I have to use:

DB::table('order_sms')->where('red_sms_id', $smsId)->update([
    'status' => $status,
    'updated_at' => Carbon::now()
]);
Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

Max maximos Joined 20 Apr 2016

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.