@@ -28,6 +28,6 @@ |
||
28 | 28 | */ |
29 | 29 | public function handle() |
30 | 30 | { |
31 | - $this->comment(PHP_EOL.Inspiring::quote().PHP_EOL); |
|
31 | + $this->comment(PHP_EOL . Inspiring::quote() . PHP_EOL); |
|
32 | 32 | } |
33 | 33 | } |
@@ -29,13 +29,13 @@ |
||
29 | 29 | $emailToSendTo = $request->input('email'); |
30 | 30 | $body = $request->input('message'); |
31 | 31 | |
32 | - Mail::send('emails.contact', ['body' => $body], function ($message) use ($name,$emailToSendTo) { |
|
32 | + Mail::send('emails.contact', [ 'body' => $body ], function($message) use ($name, $emailToSendTo) { |
|
33 | 33 | $message->from('[email protected]', "From: {$name}"); |
34 | 34 | |
35 | 35 | $message->to($emailToSendTo)->subject("Message From Laravel Hackathon Starter Contact Form"); |
36 | 36 | }); |
37 | 37 | |
38 | - return redirect()->route('contact')->with('info','Your Message has been dispatched successfully'); |
|
38 | + return redirect()->route('contact')->with('info', 'Your Message has been dispatched successfully'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | */ |
38 | 38 | public function map(Router $router) |
39 | 39 | { |
40 | - $router->group(['namespace' => $this->namespace], function ($router) { |
|
40 | + $router->group([ 'namespace' => $this->namespace ], function($router) { |
|
41 | 41 | require app_path('Http/routes.php'); |
42 | 42 | }); |
43 | 43 | } |
@@ -26,6 +26,9 @@ discard block |
||
26 | 26 | return $this->execute(($request->has('code') || $request->has('oauth_token')), $provider); |
27 | 27 | } |
28 | 28 | |
29 | + /** |
|
30 | + * @param boolean $request |
|
31 | + */ |
|
29 | 32 | public function execute($request, $provider) |
30 | 33 | { |
31 | 34 | if (! $request) { |
@@ -41,6 +44,7 @@ discard block |
||
41 | 44 | /** |
42 | 45 | * Find a user by username or create a new user |
43 | 46 | * @param |
47 | + * @param \Laravel\Socialite\Contracts\User $userData |
|
44 | 48 | * @return |
45 | 49 | */ |
46 | 50 | public function findByProviderIdOrCreate($userData, $provider) |
@@ -103,7 +107,7 @@ discard block |
||
103 | 107 | /** |
104 | 108 | * Get Data from Social Media Account |
105 | 109 | * @param string $provider |
106 | - * @return collection |
|
110 | + * @return \Laravel\Socialite\Contracts\User |
|
107 | 111 | */ |
108 | 112 | private function getSocialUser($provider) |
109 | 113 | { |
@@ -3,8 +3,6 @@ |
||
3 | 3 | namespace App\Http\Controllers; |
4 | 4 | |
5 | 5 | use Illuminate\Http\Request; |
6 | - |
|
7 | -use App\Http\Requests; |
|
8 | 6 | use App\Http\Controllers\Controller; |
9 | 7 | use Illuminate\Contracts\Auth\Guard; |
10 | 8 | use Laravel\Socialite\Contracts\Factory as Socialite; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | public function execute($request, $provider) |
30 | 30 | { |
31 | - if (! $request) { |
|
31 | + if (!$request) { |
|
32 | 32 | return $this->getAuthorizationFirst($provider); |
33 | 33 | } |
34 | 34 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | $username = $this->isEmailExists($userData->getNickName()) ? null : $userData->getEmail(); |
53 | 53 | |
54 | - if (empty($user)) { |
|
54 | + if (empty($user)) { |
|
55 | 55 | $user = User::create([ |
56 | 56 | 'fullname' => $userData->getName(), |
57 | 57 | 'username' => $username, |
@@ -69,16 +69,16 @@ discard block |
||
69 | 69 | |
70 | 70 | private function isUsernameExists($username = null) |
71 | 71 | { |
72 | - $username = User::whereUsername($username)->first()['username']; |
|
72 | + $username = User::whereUsername($username)->first()[ 'username' ]; |
|
73 | 73 | |
74 | - return (! is_null($username)) ? true : false; |
|
74 | + return (!is_null($username)) ? true : false; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | private function isEmailExists($email = null) |
78 | 78 | { |
79 | - $email = User::whereEmail($email)->first()['email']; |
|
79 | + $email = User::whereEmail($email)->first()[ 'email' ]; |
|
80 | 80 | |
81 | - return (! is_null($email)) ? true : false; |
|
81 | + return (!is_null($email)) ? true : false; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | 'username' => $user->username, |
101 | 101 | ]; |
102 | 102 | |
103 | - if (! empty(array_diff($dbData, $socialData))) { |
|
103 | + if (!empty(array_diff($dbData, $socialData))) { |
|
104 | 104 | $user->avatar = $userData->getAvatar(); |
105 | 105 | $user->fullname = $userData->getName(); |
106 | 106 | $user->username = $userData->getNickName(); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function __construct() |
39 | 39 | { |
40 | - $this->middleware('guest', ['except' => 'logout']); |
|
40 | + $this->middleware('guest', [ 'except' => 'logout' ]); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | protected function create(array $data) |
65 | 65 | { |
66 | 66 | return User::create([ |
67 | - 'fullname' => $data['name'], |
|
68 | - 'email' => $data['email'], |
|
69 | - 'password' => bcrypt($data['password']), |
|
67 | + 'fullname' => $data[ 'name' ], |
|
68 | + 'email' => $data[ 'email' ], |
|
69 | + 'password' => bcrypt($data[ 'password' ]), |
|
70 | 70 | ]); |
71 | 71 | } |
72 | 72 |
@@ -26,7 +26,7 @@ |
||
26 | 26 | |
27 | 27 | public function getAvatarUrl() |
28 | 28 | { |
29 | - if(is_null($this->avatar)) { |
|
29 | + if (is_null($this->avatar)) { |
|
30 | 30 | return "http://www.gravatar.com/avatar/" . md5(strtolower(trim($this->email))) . "?d=mm&s=40"; |
31 | 31 | } |
32 | 32 |
@@ -3,8 +3,6 @@ |
||
3 | 3 | namespace App\Http\Controllers; |
4 | 4 | |
5 | 5 | use Illuminate\Http\Request; |
6 | - |
|
7 | -use App\Http\Requests; |
|
8 | 6 | use App\Http\Controllers\Controller; |
9 | 7 | use Illuminate\Contracts\Auth\Guard; |
10 | 8 | use Laravel\Socialite\Contracts\Factory as Socialite; |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | public function updateProfile(Request $request) |
40 | 40 | { |
41 | 41 | $this->validate($request, [ |
42 | - 'email' => 'required|email|min:3|unique:users,email,'. $this->id, |
|
42 | + 'email' => 'required|email|min:3|unique:users,email,' . $this->id, |
|
43 | 43 | 'fullname' => 'required|min:3' |
44 | 44 | ]); |
45 | 45 | |
46 | 46 | $values = $request->all(); |
47 | 47 | $this->user->fill($values)->save(); |
48 | 48 | |
49 | - return redirect()->back()->with('info','Your Profile has been updated successfully'); |
|
49 | + return redirect()->back()->with('info', 'Your Profile has been updated successfully'); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | public function updateAvatar(Request $request) |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | 'file_name' => 'required|mimes:jpeg,bmp,png|between:1,7000', |
56 | 56 | ]); |
57 | 57 | |
58 | - $filename = $request->file('file_name')->getRealPath(); |
|
58 | + $filename = $request->file('file_name')->getRealPath(); |
|
59 | 59 | |
60 | 60 | Cloudder::upload($filename, null); |
61 | 61 | list($width, $height) = getimagesize($filename); |
62 | 62 | |
63 | - $fileUrl = Cloudder::show(Cloudder::getPublicId(), ["width" => $width, "height" => $height]); |
|
63 | + $fileUrl = Cloudder::show(Cloudder::getPublicId(), [ "width" => $width, "height" => $height ]); |
|
64 | 64 | |
65 | - $this->user->update(['avatar' => $fileUrl]); |
|
65 | + $this->user->update([ 'avatar' => $fileUrl ]); |
|
66 | 66 | |
67 | 67 | return redirect()->back()->with('info', 'Your Avatar has been updated Successfully'); |
68 | 68 | } |
@@ -23,17 +23,17 @@ discard block |
||
23 | 23 | { |
24 | 24 | $searchedTweets = json_decode($this->searchForTweets($this->searchItem), true); |
25 | 25 | |
26 | - return view('api.twitter')->withTweets($searchedTweets['statuses']); |
|
26 | + return view('api.twitter')->withTweets($searchedTweets[ 'statuses' ]); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | private function getLatestTweets() |
30 | 30 | { |
31 | - return Twitter::getHomeTimeline(['count' => 2, 'format' => 'json']); |
|
31 | + return Twitter::getHomeTimeline([ 'count' => 2, 'format' => 'json' ]); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | private function searchForTweets($item) |
35 | 35 | { |
36 | - return Twitter::getSearch(['q' => $item, 'count' => 4, 'format' => 'json']); |
|
36 | + return Twitter::getSearch([ 'q' => $item, 'count' => 4, 'format' => 'json' ]); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | public function sendTweet(Request $request) |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | |
45 | 45 | $tweet = $request->input('tweet') . ' #LaravelHackathonStarter'; |
46 | 46 | |
47 | - Twitter::postTweet(['status' => $tweet, 'format' => 'json']); |
|
47 | + Twitter::postTweet([ 'status' => $tweet, 'format' => 'json' ]); |
|
48 | 48 | |
49 | - return redirect()->back()->with('info','Your Tweet has been posted successfully'); |
|
49 | + return redirect()->back()->with('info', 'Your Tweet has been posted successfully'); |
|
50 | 50 | } |
51 | 51 | } |
@@ -23,43 +23,43 @@ discard block |
||
23 | 23 | | |
24 | 24 | */ |
25 | 25 | |
26 | -Route::group(['middleware' => ['web']], function () { |
|
26 | +Route::group([ 'middleware' => [ 'web' ] ], function() { |
|
27 | 27 | |
28 | - Route::get('/', function () { |
|
28 | + Route::get('/', function() { |
|
29 | 29 | return view('welcome'); |
30 | 30 | }); |
31 | 31 | |
32 | - Route::get('/api', function () { |
|
32 | + Route::get('/api', function() { |
|
33 | 33 | return view('apidashboard'); |
34 | 34 | }); |
35 | 35 | |
36 | 36 | Route::get('/api/github', [ |
37 | 37 | 'uses' => 'GithubController@getPage', |
38 | 38 | 'as' => 'api.github', |
39 | - 'middleware' => ['auth'] |
|
39 | + 'middleware' => [ 'auth' ] |
|
40 | 40 | ]); |
41 | 41 | |
42 | 42 | Route::get('/api/twitter', [ |
43 | 43 | 'uses' => 'TwitterController@getPage', |
44 | 44 | 'as' => 'api.twitter', |
45 | - 'middleware' => ['auth'] |
|
45 | + 'middleware' => [ 'auth' ] |
|
46 | 46 | ]); |
47 | 47 | |
48 | 48 | Route::post('/tweet/new', [ |
49 | 49 | 'uses' => 'TwitterController@sendTweet', |
50 | 50 | 'as' => 'tweet.new', |
51 | - 'middleware' => ['auth'] |
|
51 | + 'middleware' => [ 'auth' ] |
|
52 | 52 | ]); |
53 | 53 | |
54 | 54 | Route::get('/login', [ |
55 | 55 | 'uses' => 'Auth\AuthController@getLogin', |
56 | 56 | 'as' => 'auth.login', |
57 | - 'middleware' => ['guest'] |
|
57 | + 'middleware' => [ 'guest' ] |
|
58 | 58 | ]); |
59 | 59 | |
60 | 60 | Route::post('/login', [ |
61 | 61 | 'uses' => 'Auth\AuthController@postLogin', |
62 | - 'middleware' => ['guest'] |
|
62 | + 'middleware' => [ 'guest' ] |
|
63 | 63 | ]); |
64 | 64 | |
65 | 65 | // Password Reset Routes... |
@@ -73,50 +73,50 @@ discard block |
||
73 | 73 | Route::get('/account', [ |
74 | 74 | 'uses' => 'AccountController@getAccountPage', |
75 | 75 | 'as' => 'account.dashboard', |
76 | - 'middleware' => ['auth'] |
|
76 | + 'middleware' => [ 'auth' ] |
|
77 | 77 | ]); |
78 | 78 | |
79 | 79 | Route::post('/account/profile', [ |
80 | 80 | 'uses' => 'AccountController@updateProfile', |
81 | 81 | 'as' => 'account.profile', |
82 | - 'middleware' => ['auth'] |
|
82 | + 'middleware' => [ 'auth' ] |
|
83 | 83 | ]); |
84 | 84 | |
85 | 85 | Route::post('/account/photo', [ |
86 | 86 | 'uses' => 'AccountController@updateAvatar', |
87 | 87 | 'as' => 'account.avatar', |
88 | - 'middleware' => ['auth'] |
|
88 | + 'middleware' => [ 'auth' ] |
|
89 | 89 | ]); |
90 | 90 | |
91 | 91 | Route::post('/account/password', [ |
92 | 92 | 'uses' => 'AccountController@changePassword', |
93 | 93 | 'as' => 'account.password', |
94 | - 'middleware' => ['auth'] |
|
94 | + 'middleware' => [ 'auth' ] |
|
95 | 95 | ]); |
96 | 96 | |
97 | 97 | Route::post('/account/delete/now', [ |
98 | 98 | 'uses' => 'AccountController@deleteAccount', |
99 | 99 | 'as' => 'account.delete.now', |
100 | - 'middleware' => ['auth'] |
|
100 | + 'middleware' => [ 'auth' ] |
|
101 | 101 | ]); |
102 | 102 | |
103 | 103 | |
104 | 104 | Route::get('/account/confirm/delete', [ |
105 | 105 | 'uses' => 'AccountController@redirectToConfirmDeletePage', |
106 | 106 | 'as' => 'account.confirm.delete', |
107 | - 'middleware' => ['auth'] |
|
107 | + 'middleware' => [ 'auth' ] |
|
108 | 108 | ]); |
109 | 109 | |
110 | 110 | Route::get('/account/delete/later', [ |
111 | 111 | 'uses' => 'AccountController@dontDeleteAccount', |
112 | 112 | 'as' => 'account.dont.delete', |
113 | - 'middleware' => ['auth'] |
|
113 | + 'middleware' => [ 'auth' ] |
|
114 | 114 | ]); |
115 | 115 | |
116 | 116 | Route::get('/signup', [ |
117 | 117 | 'uses' => 'Auth\AuthController@getRegister', |
118 | 118 | 'as' => 'auth.register', |
119 | - 'middleware' => ['guest'] |
|
119 | + 'middleware' => [ 'guest' ] |
|
120 | 120 | ]); |
121 | 121 | |
122 | 122 | Route::get('logout', [ |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | |
127 | 127 | Route::post('/signup', [ |
128 | 128 | 'uses' => 'Auth\AuthController@postRegister', |
129 | - 'middleware' => ['guest'] |
|
129 | + 'middleware' => [ 'guest' ] |
|
130 | 130 | ]); |
131 | 131 | |
132 | - Route::get('/contact', function () { |
|
132 | + Route::get('/contact', function() { |
|
133 | 133 | return view('contact'); |
134 | 134 | }); |
135 | 135 |