laravel - Joining table created_at and updated_at values not being set -
i have 2 models, product , attribute. there 'product_attributes' joining table between 'products' , 'attributes'. relationship defined in both models using belongstomany(), , key of table compound 1 of product_id , attribute_id.
i can retrieve , store records in joining table - so, such functioning expected, exception created_at , updated_at in product_attributes not being set.
is above design, , there can rectify this?
you should use belongstomany function timestamps declaration this:
$this->belongstomany(<entity>)->withtimestamps();
Comments
Post a Comment