In a factory you can execute a relation model factory only when the relational id is not present by doing this. If the user_id exists in the attributes it will not execute the callback, otherwise it will.

In a factory you can execute a relation model factory only when the relational id is not present by doing this. If the user_id exists in the attributes it will not execute the callback, otherwise it will.

Category 1 laravel model relation