I have 3 models: User, Campagin, CampaginType
User has many Campagin
Campagin belongs to CampaginType
(User does not related with CampaginType)
When I save a campaign (contains user_id
and campaign_type_id
field), how can I save 2 fields with a single command.
I try like:
$user->campaigns()->campaignType($campaignType)->create($campaignInfo);
But It not work! :(