/** * @author bigsinoos <*****@*****.**> * Delete lead phone number * * @param $toBeDeleted * @return mixed */ public function deleteLeadPhones(Lead $toBeDeleted) { $deleteQueue = $toBeDeleted->phones()->get(); foreach ($deleteQueue as $item) { $item->delete(); } }
/** * @author bigsinoos <*****@*****.**> * Add relationships to a lead * * @param Lead $lead * @return \Illuminate\Database\Eloquent\Collection|static[] */ public function getAllForLead(Lead $lead) { return $lead->load('phones', 'tags'); }
/** * @author bigsinoos <*****@*****.**> * Add a tag model to a lead * * @param $lead * @param $tag * @return mixed */ public function addTagToLead(Lead $lead, Tag $tag) { $lead->tags()->attach($tag); return $lead; }