|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* GitScrum v0.1. |
|
4
|
|
|
* |
|
5
|
|
|
* @author Renato Marinho <[email protected]> |
|
6
|
|
|
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace GitScrum\Http\Controllers; |
|
10
|
|
|
|
|
11
|
|
|
use Illuminate\Http\Request; |
|
12
|
|
|
use GitScrum\Models\Issue; |
|
13
|
|
|
use GitScrum\Models\User; |
|
14
|
|
|
|
|
15
|
|
|
class UserIssueController extends Controller |
|
16
|
|
|
{ |
|
17
|
|
|
/** |
|
18
|
|
|
* Display a listing of the resource. |
|
19
|
|
|
* |
|
20
|
|
|
* @return \Illuminate\Http\Response |
|
21
|
|
|
*/ |
|
22
|
|
|
public function index($username, $slug_type = null) |
|
23
|
|
|
{ |
|
24
|
|
|
$issues = Issue::join('sprints', 'issues.sprint_id', '=', 'sprints.id') |
|
25
|
|
|
->join('issues_has_users', 'issues_has_users.issue_id', '=', 'issues.id') |
|
26
|
|
|
->join('users', 'users.id', '=', 'issues_has_users.user_id') |
|
27
|
|
|
->join('issue_types', 'issues.issue_type_id', '=', 'issue_types.id') |
|
28
|
|
|
->where('users.username', $username); |
|
29
|
|
|
|
|
30
|
|
|
if (!is_null($slug_type)) { |
|
31
|
|
|
$issues = $issues->where('issue_types.slug', $slug_type); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
$issues = $issues->orderby('issues.position', 'ASC') |
|
35
|
|
|
->select('issues.*')->paginate(env('APP_PAGINATE')); |
|
36
|
|
|
|
|
37
|
|
|
$user = User::where('username', $username) |
|
38
|
|
|
->where('provider', Auth::user()->provider) |
|
39
|
|
|
->first(); |
|
40
|
|
|
|
|
41
|
|
|
return view('user_issues.index') |
|
|
|
|
|
|
42
|
|
|
->with('issues', $issues) |
|
43
|
|
|
->with('user', $user); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Show the form for creating a new resource. |
|
48
|
|
|
* |
|
49
|
|
|
* @return \Illuminate\Http\Response |
|
|
|
|
|
|
50
|
|
|
*/ |
|
51
|
|
|
public function create() |
|
52
|
|
|
{ |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Store a newly created resource in storage. |
|
57
|
|
|
* |
|
58
|
|
|
* @param \Illuminate\Http\Request $request |
|
59
|
|
|
* |
|
60
|
|
|
* @return \Illuminate\Http\Response |
|
|
|
|
|
|
61
|
|
|
*/ |
|
62
|
|
|
public function store(Request $request) |
|
|
|
|
|
|
63
|
|
|
{ |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* Display the specified resource. |
|
68
|
|
|
* |
|
69
|
|
|
* @param int $id |
|
70
|
|
|
* |
|
71
|
|
|
* @return \Illuminate\Http\Response |
|
|
|
|
|
|
72
|
|
|
*/ |
|
73
|
|
|
public function show($id) |
|
|
|
|
|
|
74
|
|
|
{ |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* Show the form for editing the specified resource. |
|
79
|
|
|
* |
|
80
|
|
|
* @param int $id |
|
81
|
|
|
* |
|
82
|
|
|
* @return \Illuminate\Http\Response |
|
|
|
|
|
|
83
|
|
|
*/ |
|
84
|
|
|
public function edit($id) |
|
|
|
|
|
|
85
|
|
|
{ |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* Update the specified resource in storage. |
|
90
|
|
|
* |
|
91
|
|
|
* @param \Illuminate\Http\Request $request |
|
92
|
|
|
* @param int $id |
|
|
|
|
|
|
93
|
|
|
* |
|
94
|
|
|
* @return \Illuminate\Http\Response |
|
95
|
|
|
*/ |
|
96
|
|
|
public function update(Request $request, $slug) |
|
97
|
|
|
{ |
|
98
|
|
|
$members = $request->input('members'); |
|
99
|
|
|
|
|
100
|
|
|
$issue = Issue::slug($slug) |
|
101
|
|
|
->firstOrFail(); |
|
102
|
|
|
|
|
103
|
|
|
$issue->users()->sync($members); |
|
104
|
|
|
|
|
105
|
|
|
if (!$request->ajax()) { |
|
106
|
|
|
return redirect()->back()->with('success', trans('Updated successfully')); |
|
107
|
|
|
} |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
/** |
|
111
|
|
|
* Remove the specified resource from storage. |
|
112
|
|
|
* |
|
113
|
|
|
* @param int $id |
|
114
|
|
|
* |
|
115
|
|
|
* @return \Illuminate\Http\Response |
|
|
|
|
|
|
116
|
|
|
*/ |
|
117
|
|
|
public function destroy($id) |
|
|
|
|
|
|
118
|
|
|
{ |
|
119
|
|
|
} |
|
120
|
|
|
} |
|
121
|
|
|
|
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: