Passed
Push — feature/application-urls ( 540418...63f49f )
by Tristan
04:48 queued 10s
created

WorkSamplesController::update()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 28
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 19
dl 0
loc 28
rs 9.6333
c 0
b 0
f 0
cc 3
nc 4
nop 2
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use Illuminate\Support\Facades\Lang;
6
use Illuminate\Http\Request;
7
use App\Http\Controllers\Controller;
8
use App\Models\Applicant;
9
10
class WorkSamplesController extends Controller
11
{
12
    /**
13
     * Show the form for editing the logged-in applicant's Work Samples
14
     *
15
     * @param  \Illuminate\Http\Request $request Incoming Request.
16
     * @return \Illuminate\Http\RedirectResponse
17
     */
18
    public function editAuthenticated(Request $request)
19
    {
20
        $applicant = $request->user()->applicant;
21
        return redirect(route('profile.work_samples.edit', $applicant));
0 ignored issues
show
Bug introduced by
The function redirect 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

21
        return /** @scrutinizer ignore-call */ redirect(route('profile.work_samples.edit', $applicant));
Loading history...
Bug introduced by
The function route 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

21
        return redirect(/** @scrutinizer ignore-call */ route('profile.work_samples.edit', $applicant));
Loading history...
22
    }
23
24
    /**
25
     * Show the form for editing the applicant's work samples
26
     *
27
     * @param  \Illuminate\Http\Request $request   Incoming request object.
28
     * @param  \App\Models\Applicant    $applicant Incoming Applicant object.
29
     * @return \Illuminate\Http\Response
30
     */
31
    public function edit(Request $request, Applicant $applicant)
32
    {
33
        $custom_breadcrumbs = [
34
            'home' => route('home'),
0 ignored issues
show
Bug introduced by
The function route 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

34
            'home' => /** @scrutinizer ignore-call */ route('home'),
Loading history...
35
            'profile' => '',
36
        ];
37
38
        $applicant->load([
39
            'work_samples',
40
            'skill_declarations.skill',
41
        ]);
42
43
        return view('applicant/profile_05_portfolio', [
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

43
        return /** @scrutinizer ignore-call */ view('applicant/profile_05_portfolio', [
Loading history...
44
            'applicant' => $applicant,
45
            'profile' => Lang::get('applicant/profile_work_samples'),
46
            'custom_breadcrumbs' => $custom_breadcrumbs,
47
        ]);
48
    }
49
}
50