TimelogController::show()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 1
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use App\Project;
6
use Illuminate\Http\Request;
7
8
class TimelogController extends Controller
9
{
10
    /**
11
     * Instantiate a new TimelogController
12
     */
13
    public function __construct()
14
    {
15
        $this->middleware('auth');
16
    }
17
18
    /**
19
     * View the timelogs for a project (used for pop up window)
20
     *
21
     * @param \App\Project $project
22
     * @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
23
     */
24
    public function show(Project $project)
25
    {
26
        if (!auth()->user()->can('view', $project)) {
27
            return redirect()->route('home');
28
        }
29
30
        $this->seo()->setTitle('Logging Time: '.$project->title);
31
        $this->seo()->setDescription($project->description);
32
33
        return view('projects.timelogs.show', compact('project'));
34
    }
35
}
36