|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace GitScrum\Http\Controllers; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Http\Request; |
|
6
|
|
|
use GitScrum\Models\ProductBacklog; |
|
7
|
|
|
use Auth; |
|
8
|
|
|
|
|
9
|
|
|
class WizardController extends Controller |
|
10
|
|
|
{ |
|
11
|
|
|
public function step1() |
|
|
|
|
|
|
12
|
|
|
{ |
|
13
|
|
|
$repositories = (object) app(Auth::user()->provider)->readRepositories(); |
|
14
|
|
|
$currentRepositories = ProductBacklog::all(); |
|
15
|
|
|
|
|
16
|
|
|
\Session::put('Repositories', $repositories); |
|
17
|
|
|
|
|
18
|
|
|
return view('wizard.step1') |
|
|
|
|
|
|
19
|
|
|
->with('repositories', $repositories) |
|
20
|
|
|
->with('currentRepositories', $currentRepositories) |
|
21
|
|
|
->with('columns', ['checkbox', 'repository', 'organization']); |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
public function step2(Request $request) |
|
|
|
|
|
|
25
|
|
|
{ |
|
26
|
|
|
$repositories = \Session::get('Repositories')->whereIn('provider_id', $request->repos); |
|
27
|
|
|
foreach ($repositories as $repository) { |
|
28
|
|
|
app(Auth::user()->provider)->readCollaborators($repository->organization_title, $repository->title, $repository->provider_id); |
|
29
|
|
|
$product_backlog = ProductBacklog::where('provider_id', $repository->provider_id)->first(); |
|
30
|
|
|
if (!isset($product_backlog)) { |
|
31
|
|
|
$product_backlog = ProductBacklog::create(get_object_vars($repository)); |
|
32
|
|
|
} |
|
33
|
|
|
app(Auth::user()->provider)->createBranches($repository->organization_title, $product_backlog->id, $repository->title, $repository->provider_id); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
return view('wizard.step2') |
|
|
|
|
|
|
37
|
|
|
->with('repositories', $repositories) |
|
38
|
|
|
->with('columns', ['repository', 'organization']); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public function step3() |
|
42
|
|
|
{ |
|
43
|
|
|
$result = app(Auth::user()->provider)->readIssues(); |
|
|
|
|
|
|
44
|
|
|
|
|
45
|
|
|
return redirect()->route('issues.index', ['slug' => 0]); |
|
46
|
|
|
} |
|
47
|
|
|
} |
|
48
|
|
|
|
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@returnannotation as described here.