Test Setup Failed
Push — master ( afb38e...66319d )
by Manu
12:34
created

SocialAuthFacebookController::callback()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
// SocialAuthFacebookController.php
4
5
namespace App\Http\Controllers;
6
7
use Illuminate\Http\Request;
8
use Socialite;
9
use App\Services\SocialFacebookAccountService;
10
11
class SocialAuthFacebookController extends Controller
12
{
13
  /**
14
   * Create a redirect method to twitter api.
15
   *
16
   * @return void
17
   */
18
    public function redirect()
19
    {
20
        return Socialite::driver('facebook')->redirect();
21
    }
22
23
    /**
24
     * Return a callback method from twitter api.
25
     *
26
     * @return callback URL from twitter
27
     */
28
    public function callback(SocialFacebookAccountService $service)
29
    {
30
        $user = $service->createOrGetUser(Socialite::driver('facebook')->user());
31
        auth()->login($user);
32
        return redirect()->to('/home');
33
    }
34
}
35