Skip to content

reviewable_type and reviewable_id - Column not found #50

@bigperson

Description

@bigperson

$table->morphs('reviewrateable'); creating two fields in table
reviewrateable_type and reviewrateable_id
https://github.com/codebyray/laravel-review-rateable/blob/master/database/migrations/create_reviews_table.php.stub#L22

but in rating model use $this->morphTo(__FUNCTION__, 'reviewable_type', 'reviewable_id'); for create relation - is not identical in database table
https://github.com/codebyray/laravel-review-rateable/blob/master/src/Models/Rating.php#L35

i have the error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'reviewable_type' in 'field list' (SQL: update `reviews` set `customer_service_rating` = , `quality_rating` = , `friendly_rating` = , `price_rating` = , `recommend` = 1, `body` = ..., `approved` = 1, `reviewable_type` = App\\Models\\Contacts\\Contact, `reviewable_id` = 170, `reviews`.`updated_at` = 2022-12-22 13:31:42 where `id` = 6238)"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions