jeudi 3 décembre 2015

Laravel Polymorphic Relationship trouble with Camel Case

In my polymorphic relationship, Laravel automatically converts my CamelCase id to an underscore. So when I try to get $store->product, I receive Column not found: 1054 Unknown column 'Products.location_id'.

My relationship looks like this.

Class Store() {
    public function product() {
        return $this->morphOne('App\Models\Product', 'locationId');
    }
}

Is there a way to not convert to underscore from CamelCase.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1N5Yrqi
via IFTTT

Aucun commentaire:

Enregistrer un commentaire