In a controller called activities, I have a method called reminder. This method, receives an id, searches for that activity based on this id and sends an email to the moderator of that activity with data of the same. Is this method with 'too much responsibility'?
I am sending two methods to join another question. By code designer, which one is correct? What does it send separates the $ client into a variable (reminder_a), or does it always use $ activity to refer to clients (reminder_b)?
Follow method:
/**
* Send the remember email with a resource
* @param int $id
*/
public function reminder_a($id)
{
$activity = $this->activities->getById($id);
$client = $activity->client;
$title = 'Reminder of activity ' . $activity->name;
$view = 'emails.activity.reminder';
$data = ['activity' => $activity, 'cliente' => $client];
CustomMail::sendBasicMail($view, $title, $activity->client->email, $data);
}
/**
* Send the remember email with a resource
* @param int $id
*/
public function reminder_b($id)
{
$activity = $this->activities->getById($id);
$title = 'Reminder of activity ' . $activity->name;
$view = 'emails.activity.reminder';
CustomMail::sendBasicMail($view, $title, $activity->client->email, $activity);
}