niclasleonbock /
hacktoberfest-status
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Http\Controllers; |
||
| 4 | |||
| 5 | use Auth; |
||
| 6 | use App\Hacktoberfest\GitHub\PullRequestChecker; |
||
| 7 | |||
| 8 | class HomeController extends Controller |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Instance of the 'pull request checker'. |
||
| 12 | */ |
||
| 13 | protected $checker; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Create a new controller instance. |
||
| 17 | * |
||
| 18 | * @param PullRequestChecker $checker |
||
| 19 | * @internal param PullRequestChecker $prChecker |
||
| 20 | */ |
||
| 21 | public function __construct(PullRequestChecker $checker) |
||
| 22 | { |
||
| 23 | $this->checker = $checker; |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Display the current status if the user already signed in via GitHubs' OAuth API. |
||
| 28 | * Display some infotext and the sign in button otherwise. |
||
| 29 | * |
||
| 30 | * @return Illuminate\View\View |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 31 | */ |
||
| 32 | public function index() |
||
| 33 | { |
||
| 34 | if (Auth::check()) { |
||
| 35 | $user = Auth::user(); |
||
| 36 | |||
| 37 | $prs = $this->checker->getQualifiedPullRequests($user); |
||
| 38 | |||
| 39 | return view('status', [ |
||
|
0 ignored issues
–
show
|
|||
| 40 | 'user' => $user, |
||
| 41 | 'prs' => $prs |
||
| 42 | ]); |
||
| 43 | } |
||
| 44 | |||
| 45 | return view('index'); |
||
|
0 ignored issues
–
show
|
|||
| 46 | } |
||
| 47 | } |
||
| 48 |