问题描述:

I have simple question here.

$order = Order::where('unique_id', $id)->first();

$canPickup = $order->canPickup();

$order->payment_id = Input::get('payment_id');

$order->save();

$order2 = Order::where('unique_id', $id)->first();

$canPickup; //return false

$order->canPickup(); //return false

$order2->canPickup(); //return true

Why $order->canPickup(); differs form $order2->canPickup(); how I can achieve this function to return new value without creating new instance? Thanks

Update:

In canPickup() method i use paymentType relationship:

public function paymentType()

{

return $this->belongsTo('PaymentType', 'payment_id');

}

And in same method I have these results. Why these values differs?

Debugbar::warning($this->payment_id); //return 3

Debugbar::warning($this->paymentType->id); //return old value 1.

相关阅读:
Top