|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Gitamin\Http\Controllers\Projects; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Http\Request; |
|
6
|
|
|
use Illuminate\Foundation\Bus\DispatchesJobs; |
|
7
|
|
|
use Illuminate\Support\Facades\Redirect; |
|
8
|
|
|
use Illuminate\Support\Facades\Auth; |
|
9
|
|
|
use Illuminate\Support\Facades\View; |
|
10
|
|
|
use Gitamin\Http\Controllers\Controller; |
|
11
|
|
|
use GrahamCampbell\Binput\Facades\Binput; |
|
12
|
|
|
use Gitamin\Commands\Issue\AddIssueCommand; |
|
13
|
|
|
use Gitamin\Commands\Issue\RemoveIssueCommand; |
|
14
|
|
|
use Gitamin\Commands\Issue\UpdateIssueCommand; |
|
15
|
|
|
use Gitamin\Models\Project; |
|
16
|
|
|
use Gitamin\Models\ProjectNamespace; |
|
17
|
|
|
use Gitamin\Models\Group; |
|
18
|
|
|
use Gitamin\Models\Tag; |
|
19
|
|
|
use Gitamin\Models\Issue; |
|
20
|
|
|
|
|
21
|
|
|
class IssuesController extends Controller |
|
22
|
|
|
{ |
|
23
|
|
|
|
|
24
|
|
|
protected $active_item = 'issues'; |
|
25
|
|
|
/** |
|
26
|
|
|
* Display a listing of the resource. |
|
27
|
|
|
* |
|
28
|
|
|
* @return \Illuminate\Http\Response |
|
29
|
|
|
*/ |
|
30
|
|
|
|
|
31
|
|
|
public function index($namespace, $project_path) |
|
32
|
|
|
{ |
|
33
|
|
|
$project = $this->getProject($namespace, $project_path); |
|
34
|
|
|
|
|
35
|
|
|
return View::make('projects.issues.index') |
|
36
|
|
|
->withProject($project) |
|
37
|
|
|
->withIssues($project->issues) |
|
38
|
|
|
->withActiveItem($this->active_item) |
|
39
|
|
|
->withPageTitle(sprintf('%s - %s', trans('dashboard.issues.issues'), $project->name)); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
public function new($namespace, $project_path) |
|
43
|
|
|
{ |
|
44
|
|
|
$project = $this->getProject($namespace, $project_path); |
|
45
|
|
|
|
|
46
|
|
|
return View::make('projects.issues.new') |
|
47
|
|
|
->withProject($project) |
|
48
|
|
|
->withPageTitle(sprintf('%s - %s', trans('dashboard.issues.issues'), $project->name)) |
|
49
|
|
|
->withActiveItem($this->active_item); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* Show the form for creating a new resource. |
|
54
|
|
|
* |
|
55
|
|
|
* @return \Illuminate\Http\Response |
|
56
|
|
|
*/ |
|
57
|
|
|
public function create($namespace, $project_path) |
|
58
|
|
|
{ |
|
59
|
|
|
$project = $this->getProject($namespace, $project_path); |
|
60
|
|
|
$issueData = Binput::get('issue'); |
|
61
|
|
|
|
|
62
|
|
|
try { |
|
63
|
|
|
$issueData['author_id'] = Auth::user()->id; |
|
64
|
|
|
$issueData['project_id'] = $project->id; |
|
65
|
|
|
$issue = $this->dispatchFromArray(AddIssueCommand::class, $issueData); |
|
|
|
|
|
|
66
|
|
|
} catch (ValidationException $e) { |
|
|
|
|
|
|
67
|
|
|
return Redirect::route('projects.issue_new') |
|
68
|
|
|
->withInput(Binput::all()) |
|
69
|
|
|
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.issues.new.failure'))) |
|
70
|
|
|
->withErrors($e->getMessageBag()); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
return Redirect::route('projects.issue_index', ['namespace' => $namespace, 'project'=> $project_path]) |
|
74
|
|
|
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.issues.new.success'))); |
|
75
|
|
|
|
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Display the specified resource. |
|
80
|
|
|
* |
|
81
|
|
|
* @param int $id |
|
|
|
|
|
|
82
|
|
|
* @return \Illuminate\Http\Response |
|
83
|
|
|
*/ |
|
84
|
|
|
public function show($namespace, $project, Issue $issue) |
|
|
|
|
|
|
85
|
|
|
{ |
|
86
|
|
|
// |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* Show the form for editing the specified resource. |
|
91
|
|
|
* |
|
92
|
|
|
* @param int $id |
|
93
|
|
|
* @return \Illuminate\Http\Response |
|
94
|
|
|
*/ |
|
95
|
|
|
public function edit($id) |
|
|
|
|
|
|
96
|
|
|
{ |
|
97
|
|
|
// |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* Update the specified resource in storage. |
|
102
|
|
|
* |
|
103
|
|
|
* @param \Illuminate\Http\Request $request |
|
104
|
|
|
* @param int $id |
|
105
|
|
|
* @return \Illuminate\Http\Response |
|
106
|
|
|
*/ |
|
107
|
|
|
public function update(Request $request, $id) |
|
|
|
|
|
|
108
|
|
|
{ |
|
109
|
|
|
// |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* Remove the specified resource from storage. |
|
114
|
|
|
* |
|
115
|
|
|
* @param int $id |
|
116
|
|
|
* @return \Illuminate\Http\Response |
|
117
|
|
|
*/ |
|
118
|
|
|
public function destroy($id) |
|
|
|
|
|
|
119
|
|
|
{ |
|
120
|
|
|
// |
|
121
|
|
|
} |
|
122
|
|
|
} |
|
123
|
|
|
|
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.