Level 41
Yes, you can do so by defining a mutator:
class YourModel extends Model
{
public function setCurrencyAttribute($value)
{
$this->attributes['currency_id'] = $value->id;
}
}
$this->currency_id = $currency->id in my model's method.$this->currency = $currency without have to specify the _id and ->id?$model->currency = $currency and it works, I just want to have a consistent style of assigning modelsPlease or to participate in this conversation.