Passed
Push — dependabot/npm_and_yarn/dev/st... ( 917c39...79f3f4 )
by
unknown
12:32 queued 07:14
created

HomepageController::hr_advisor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use Illuminate\Support\Facades\Lang;
6
use App\Http\Controllers\Controller;
7
use App\Models\JobPoster;
8
use Carbon\Carbon;
9
10
class HomepageController extends Controller
11
{
12
    /**
13
     * Show the applicant home page.
14
     * @return \Illuminate\Http\Response
15
     */
16
    public function applicant()
17
    {
18
        $now = Carbon::now();
19
20
        // Find three most recent published jobs that are currently open for applications.
21
        // Eager load required relationships: Department, Province, JobTerm.
22
        $jobs = JobPoster::where('open_date_time', '<=', $now)
23
            ->where('close_date_time', '>=', $now)
24
            ->where('published', true)
25
            ->with([
26
                'department',
27
                'province',
28
            ])
29
            ->orderBy('open_date_time', 'desc')
30
            ->take(3)
31
            ->get();
32
        return view('applicant/home', [
0 ignored issues
show
Bug introduced by
The function view was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

32
        return /** @scrutinizer ignore-call */ view('applicant/home', [
Loading history...
33
            'home' => Lang::get('applicant/home'),
34
            'hero' => Lang::get('common/hero'),
35
            'job_index' => Lang::get('applicant/job_index'),
36
            'job_post' => Lang::get('applicant/job_post'),
37
            'jobs' => $jobs,
38
            'job_count' => count($jobs)
39
        ]);
40
    }
41
42
    /**
43
     * Show the manager home page.
44
     * @return \Illuminate\Http\Response
45
     */
46
    public function manager()
47
    {
48
        return view('manager/home', [
0 ignored issues
show
Bug introduced by
The function view was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

48
        return /** @scrutinizer ignore-call */ view('manager/home', [
Loading history...
49
            'home_l10n' => Lang::get('manager/home'),
50
        ]);
51
    }
52
53
    /**
54
     * Show the hr_advisor home page.
55
     * @return \Illuminate\Http\Response
56
     */
57
    public function hr_advisor() //phpcs:ignore
58
    {
59
        return view('hr_advisor/home', [
0 ignored issues
show
Bug introduced by
The function view was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

59
        return /** @scrutinizer ignore-call */ view('hr_advisor/home', [
Loading history...
60
            'hr_home' => Lang::get('hr_advisor/home'),
61
        ]);
62
    }
63
}
64