Recommand · May 27, 2021 0

How i can search morph object in python orator?

I have in orator

table.morphs('element')

in object1 model

@morph_many('element')

in object2 model same

@morph_many('element')

and i try save in my base

    element = object1.where('name', '=', details.element).first()
    if element is None:
        element = object2.where('uid', '=', details.element).first_or_fail()

how can i make it easier?