1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Http\Controllers\Api; |
4
|
|
|
|
5
|
|
|
use App\Http\Controllers\Controller; |
6
|
|
|
use App\Mail\MicroReferenceMail; |
7
|
|
|
use App\Models\JobApplication; |
8
|
|
|
use Illuminate\Support\Facades\Mail; |
9
|
|
|
|
10
|
|
|
class MicroReferenceController extends Controller |
11
|
|
|
{ |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Get email created to be sent to an application's Director reference. |
15
|
|
|
* |
16
|
|
|
* @param JobApplication $application The application the reference is for. |
17
|
|
|
* |
18
|
|
|
* @return \Illuminate\Http\Response |
19
|
|
|
*/ |
20
|
|
|
public function showDirectorEmail(JobApplication $application) |
21
|
|
|
{ |
22
|
|
|
$mail = new MicroReferenceMail($application, true); |
23
|
|
|
return response()->json($mail->build()->toArray()); |
|
|
|
|
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public function sendDirectorEmail(JobApplication $application) |
27
|
|
|
{ |
28
|
|
|
$mail = new MicroReferenceMail($application, true); |
29
|
|
|
Mail::send($mail->build()); |
30
|
|
|
return response()->json($mail->build()->toArray()); |
|
|
|
|
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Get email created to be sent to an application's Secondary reference. |
35
|
|
|
* |
36
|
|
|
* @param JobApplication $application The application the reference is for. |
37
|
|
|
* |
38
|
|
|
* @return \Illuminate\Http\Response |
39
|
|
|
*/ |
40
|
|
|
public function showSecondaryReferenceEmail(JobApplication $application) |
41
|
|
|
{ |
42
|
|
|
$mail = new MicroReferenceMail($application, false); |
43
|
|
|
return response()->json($mail->build()->toArray()); |
|
|
|
|
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function sendSecondaryReferenceEmail(JobApplication $application) |
47
|
|
|
{ |
48
|
|
|
$mail = new MicroReferenceMail($application, false); |
49
|
|
|
Mail::send($mail->build()); |
50
|
|
|
return response()->json($mail->build()->toArray()); |
|
|
|
|
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|