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

webmaster
webmaster

Hello,

I have two database peoples ['name','family','gender','type_id'] and types [id,name,status]

I have a problem, type just could be for one people! and when I use same type for another people previous record will set to 0 and current people get type. i just could set type just to one people!

any one know why it's occure?

Scott
Scott

Could you show us the model in question? I won't be able to help without seeing the code.

kattsoff
kattsoff

In People Model you should use something like this

public $belongsTo = [
        'types' => ['NameOfRootFolderWithYourPlugins\NameOfPlugin\Models\Types', 'order' => 'name']
    ];
webmaster
webmaster

i explain it again with more description:

we have two table: user_table[id,name,family,email,status] and another table is user_status_table[id,name] I want to load status values from user_status_table when editing users.

webmaster
webmaster

I think i found the solution. I should define new function for it not relation. and it's work as well.

1-5 of 5

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