TimelogController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A show() 0 10 2
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