This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

designittome21809
designittome21809

Hi I trying to estimate a one to many relation between Services and Categories they got a models named Service and Categorie (I know that name mistake =) ) accordingly, I set relation in Service.php

public $belongsToMany = [

    'categorie' =>[

        'HolstCa\Sevices\Models\Categorie',

        'table' => 'holstca_services_pivit',
        'key'   => 'categorie_id',

        'order' => 'categorie_name',

    ]
];

but It keep throwing error Class 'HolstCa\Sevices\Models\Categorie' not found

plz help!

Sam
Sam

designittome21809 said:

Hi I trying to estimate a one to many relation between Services and Categories they got a models named Service and Categorie (I know that name mistake =) ) accordingly, I set relation in Service.php

public $belongsToMany = [

   'categorie' =>[

       'HolstCa\Sevices\Models\Categorie',

       'table' => 'holstca_services_pivit',
       'key'   => 'categorie_id',

       'order' => 'categorie_name',

   ]

];

but It keep throwing error Class 'HolstCa\Sevices\Models\Categorie' not found

plz help!

Your pivot table should be named "holstca_services_categories" and you will also need to define the reverse relationship in the Service model.

Last updated

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.