athenahr/app/Services/MeetingNoteService.php
miguel456 3727c84f3e
refactor: code style changes
Signed-off-by: miguel456 <me@nogueira.codes>
2023-01-15 00:04:00 +00:00

33 lines
846 B
PHP
Executable File

<?php
namespace App\Services;
use App\Application;
use App\Exceptions\InvalidAppointmentException;
class MeetingNoteService
{
/**
* Adds meeting notes to an application.
*
* @param Application $application
* @param $noteText
* @return bool
*
* @throws InvalidAppointmentException Thrown when an application doesn't have an appointment to save notes to
*/
public function addToApplication(Application $application, $noteText): bool
{
if (! is_null($application)) {
$application->load('appointment');
$application->appointment->meetingNotes = $noteText;
$application->appointment->save();
return true;
} else {
throw new InvalidAppointmentException('There\'s no appointment to save notes to!');
}
}
}