1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Http\Controllers; |
4
|
|
|
|
5
|
|
|
use App\Http\Controllers\Controller; |
6
|
|
|
use App\Models\JobPoster; |
7
|
|
|
use App\Models\HrAdvisor; |
8
|
|
|
use Illuminate\Http\Request; |
9
|
|
|
use Illuminate\Support\Facades\Auth; |
10
|
|
|
use Illuminate\Support\Facades\Lang; |
11
|
|
|
|
12
|
|
|
class JobSummaryController extends Controller |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* Display the specified job summary. |
16
|
|
|
* |
17
|
|
|
* @param \Illuminate\Http\Request $request Incoming request object. |
18
|
|
|
* @param \App\Models\JobPoster $job Job Poster object. |
19
|
|
|
* @return \Illuminate\Http\Response |
20
|
|
|
*/ |
21
|
|
|
public function show(Request $request, JobPoster $job) |
22
|
|
|
{ |
23
|
|
|
$user = Auth::user(); |
24
|
|
|
|
25
|
|
|
$applications = $job->submitted_applications()->get(); |
26
|
|
|
|
27
|
|
|
$data = [ |
28
|
|
|
// Localized strings. |
29
|
|
|
'summary' => Lang::get('hr_advisor/job_summary'), |
30
|
|
|
// User data. |
31
|
|
|
'user' => $user, |
32
|
|
|
// Job Poster data. |
33
|
|
|
'job' => $job, |
34
|
|
|
// Application data. |
35
|
|
|
'applications' => $applications, |
36
|
|
|
// TODO: Add Routes. |
37
|
|
|
// 'send_manager' => , |
38
|
|
|
// 'send_translation' => , |
39
|
|
|
// 'approve_publishing' => , |
40
|
|
|
'relinquish_job' => route('hr_advisor.jobs.unclaim', $job), |
41
|
|
|
]; |
42
|
|
|
|
43
|
|
|
return view( |
44
|
|
|
'hr_advisor/job_summary', |
45
|
|
|
$data |
46
|
|
|
); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Unclaim a Job Poster. |
51
|
|
|
* |
52
|
|
|
* @param \App\Models\HrAdvisor $hrAdvisor |
53
|
|
|
* @param \App\Models\JobPoster $job |
54
|
|
|
* @return \Illuminate\Http\Response |
55
|
|
|
*/ |
56
|
|
|
public function unclaimJob(HrAdvisor $hrAdvisor, JobPoster $job) |
57
|
|
|
{ |
58
|
|
|
$hrAdvisor->claimed_jobs()->detach($job); |
59
|
|
|
|
60
|
|
|
return redirect()->route('hr_advisor.jobs.summary', $job); |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|