@@ -2,15 +2,10 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace App\Http\Controllers; |
| 4 | 4 | |
| 5 | -use Illuminate\Http\Request; |
|
| 6 | - |
|
| 7 | -use App\Http\Requests; |
|
| 8 | 5 | use App\Http\Controllers\Controller; |
| 9 | 6 | use Facebook; |
| 10 | -use App\User; |
|
| 11 | 7 | use Auth; |
| 12 | 8 | use Session; |
| 13 | -use Illuminate\Support\Collection; |
|
| 14 | 9 | |
| 15 | 10 | class FacebookController extends Controller |
| 16 | 11 | { |
@@ -41,8 +41,8 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | private function getData() |
| 43 | 43 | { |
| 44 | - $data = Facebook::get('/me?fields=id,name,cover,email,gender,first_name,last_name,locale,timezone,link,picture', Auth::user()->getAccessToken()); |
|
| 44 | + $data = Facebook::get('/me?fields=id,name,cover,email,gender,first_name,last_name,locale,timezone,link,picture', Auth::user()->getAccessToken()); |
|
| 45 | 45 | |
| 46 | - return json_decode($data->getGraphUser(),true); |
|
| 46 | + return json_decode($data->getGraphUser(),true); |
|
| 47 | 47 | } |
| 48 | 48 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function getPage() |
| 24 | 24 | { |
| 25 | - if( Session::get('provider') !== 'facebook') { |
|
| 25 | + if (Session::get('provider') !== 'facebook') { |
|
| 26 | 26 | Auth::logout(); |
| 27 | 27 | |
| 28 | 28 | Session::flush(); |
@@ -43,6 +43,6 @@ discard block |
||
| 43 | 43 | { |
| 44 | 44 | $data = Facebook::get('/me?fields=id,name,cover,email,gender,first_name,last_name,locale,timezone,link,picture', Auth::user()->getAccessToken()); |
| 45 | 45 | |
| 46 | - return json_decode($data->getGraphUser(),true); |
|
| 46 | + return json_decode($data->getGraphUser(), true); |
|
| 47 | 47 | } |
| 48 | 48 | } |
@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | class LinkedInController extends Controller |
| 15 | 15 | { |
| 16 | - /** |
|
| 17 | - * LinkedIn API base Url |
|
| 18 | - * @var string |
|
| 19 | - */ |
|
| 16 | + /** |
|
| 17 | + * LinkedIn API base Url |
|
| 18 | + * @var string |
|
| 19 | + */ |
|
| 20 | 20 | protected $baseUrl; |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -31,19 +31,19 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | protected $response; |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Initialize the Controller with necessary arguments |
|
| 36 | - */ |
|
| 34 | + /** |
|
| 35 | + * Initialize the Controller with necessary arguments |
|
| 36 | + */ |
|
| 37 | 37 | public function __construct() |
| 38 | 38 | { |
| 39 | 39 | $this->baseUrl = 'https://api.linkedin.com/v1'; |
| 40 | 40 | $this->client = new Client(['base_uri' => $this->baseUrl]); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Set options for making the Client request |
|
| 45 | - * @return void |
|
| 46 | - */ |
|
| 43 | + /** |
|
| 44 | + * Set options for making the Client request |
|
| 45 | + * @return void |
|
| 46 | + */ |
|
| 47 | 47 | private function setRequestOptions() |
| 48 | 48 | { |
| 49 | 49 | $authBearer = 'Bearer '. Auth::user()->getAccessToken(); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | public function __construct() |
| 38 | 38 | { |
| 39 | 39 | $this->baseUrl = 'https://api.linkedin.com/v1'; |
| 40 | - $this->client = new Client(['base_uri' => $this->baseUrl]); |
|
| 40 | + $this->client = new Client([ 'base_uri' => $this->baseUrl ]); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -46,13 +46,13 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | private function setRequestOptions() |
| 48 | 48 | { |
| 49 | - $authBearer = 'Bearer '. Auth::user()->getAccessToken(); |
|
| 50 | - $this->client = new Client(['base_uri' => $this->baseUrl, |
|
| 49 | + $authBearer = 'Bearer ' . Auth::user()->getAccessToken(); |
|
| 50 | + $this->client = new Client([ 'base_uri' => $this->baseUrl, |
|
| 51 | 51 | 'headers' => [ |
| 52 | 52 | 'Authorization' => $authBearer, |
| 53 | 53 | 'Content-Type' => 'application/json', |
| 54 | 54 | 'Accept' => 'application/json' |
| 55 | - ]]); |
|
| 55 | + ] ]); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | private function setGetResponse($relativeUrl) |
| 63 | 63 | { |
| 64 | - $this->response = $this->client->get($this->baseUrl . $relativeUrl, []); |
|
| 64 | + $this->response = $this->client->get($this->baseUrl . $relativeUrl, [ ]); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function getPage() |
| 33 | 33 | { |
| 34 | - if( Session::get('provider') !== 'twitter') { |
|
| 34 | + if (Session::get('provider') !== 'twitter') { |
|
| 35 | 35 | Auth::logout(); |
| 36 | 36 | |
| 37 | 37 | Session::flush(); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | $searchedTweets = json_decode($this->searchForTweets($this->searchItem), true); |
| 43 | 43 | |
| 44 | - return view('api.twitter')->withTweets($searchedTweets['statuses']); |
|
| 44 | + return view('api.twitter')->withTweets($searchedTweets[ 'statuses' ]); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | private function getLatestTweets() |
| 52 | 52 | { |
| 53 | - return Twitter::getHomeTimeline(['count' => 2, 'format' => 'json']); |
|
| 53 | + return Twitter::getHomeTimeline([ 'count' => 2, 'format' => 'json' ]); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | private function searchForTweets($item) |
| 62 | 62 | { |
| 63 | - return Twitter::getSearch(['q' => $item, 'count' => 4, 'format' => 'json']); |
|
| 63 | + return Twitter::getSearch([ 'q' => $item, 'count' => 4, 'format' => 'json' ]); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -76,10 +76,10 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | $tweet = $request->input('tweet') . ' #LaravelHackathonStarter'; |
| 78 | 78 | |
| 79 | - Twitter::reconfig(['token' => Auth::user()->getAccessToken(), 'secret' => Auth::user()->getAccessTokenSecret()]); |
|
| 79 | + Twitter::reconfig([ 'token' => Auth::user()->getAccessToken(), 'secret' => Auth::user()->getAccessTokenSecret() ]); |
|
| 80 | 80 | |
| 81 | - Twitter::postTweet(['status' => $tweet, 'format' => 'json']); |
|
| 81 | + Twitter::postTweet([ 'status' => $tweet, 'format' => 'json' ]); |
|
| 82 | 82 | |
| 83 | - return redirect()->back()->with('info','Your Tweet has been posted successfully'); |
|
| 83 | + return redirect()->back()->with('info', 'Your Tweet has been posted successfully'); |
|
| 84 | 84 | } |
| 85 | 85 | } |
@@ -23,143 +23,143 @@ 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::get('/api/lastfm', [ |
| 49 | 49 | 'uses' => 'LastFmController@getPage', |
| 50 | 50 | 'as' => 'api.lastfm', |
| 51 | - 'middleware' => ['auth'] |
|
| 51 | + 'middleware' => [ 'auth' ] |
|
| 52 | 52 | ]); |
| 53 | 53 | |
| 54 | 54 | Route::get('/api/nyt', [ |
| 55 | 55 | 'uses' => 'NytController@getPage', |
| 56 | 56 | 'as' => 'api.nyt', |
| 57 | - 'middleware' => ['auth'] |
|
| 57 | + 'middleware' => [ 'auth' ] |
|
| 58 | 58 | ]); |
| 59 | 59 | |
| 60 | 60 | Route::get('/api/steam', [ |
| 61 | 61 | 'uses' => 'SteamController@getPage', |
| 62 | 62 | 'as' => 'api.steam', |
| 63 | - 'middleware' => ['auth'] |
|
| 63 | + 'middleware' => [ 'auth' ] |
|
| 64 | 64 | ]); |
| 65 | 65 | |
| 66 | 66 | Route::get('/api/stripe', [ |
| 67 | 67 | 'uses' => 'StripeController@getPage', |
| 68 | 68 | 'as' => 'api.stripe', |
| 69 | - 'middleware' => ['auth'] |
|
| 69 | + 'middleware' => [ 'auth' ] |
|
| 70 | 70 | ]); |
| 71 | 71 | |
| 72 | 72 | Route::get('/api/paypal', [ |
| 73 | 73 | 'uses' => 'PaypalController@getPage', |
| 74 | 74 | 'as' => 'api.paypal', |
| 75 | - 'middleware' => ['auth'] |
|
| 75 | + 'middleware' => [ 'auth' ] |
|
| 76 | 76 | ]); |
| 77 | 77 | |
| 78 | 78 | Route::get('/api/twilio', [ |
| 79 | 79 | 'uses' => 'TwilioController@getPage', |
| 80 | 80 | 'as' => 'api.twilio', |
| 81 | - 'middleware' => ['auth'] |
|
| 81 | + 'middleware' => [ 'auth' ] |
|
| 82 | 82 | ]); |
| 83 | 83 | |
| 84 | 84 | Route::post('/api/twilio', [ |
| 85 | 85 | 'uses' => 'TwilioController@sendTextMessage', |
| 86 | - 'middleware' => ['auth'] |
|
| 86 | + 'middleware' => [ 'auth' ] |
|
| 87 | 87 | ]); |
| 88 | 88 | |
| 89 | 89 | Route::get('/api/scraping', [ |
| 90 | 90 | 'uses' => 'WebScrapingController@getPage', |
| 91 | 91 | 'as' => 'api.scraping', |
| 92 | - 'middleware' => ['auth'] |
|
| 92 | + 'middleware' => [ 'auth' ] |
|
| 93 | 93 | ]); |
| 94 | 94 | |
| 95 | 95 | Route::get('/api/yahoo', [ |
| 96 | 96 | 'uses' => 'YahooController@getPage', |
| 97 | 97 | 'as' => 'api.yahoo', |
| 98 | - 'middleware' => ['auth'] |
|
| 98 | + 'middleware' => [ 'auth' ] |
|
| 99 | 99 | ]); |
| 100 | 100 | |
| 101 | 101 | Route::get('/api/clockwork', [ |
| 102 | 102 | 'uses' => 'ClockworkController@getPage', |
| 103 | 103 | 'as' => 'api.clockwork', |
| 104 | - 'middleware' => ['auth'] |
|
| 104 | + 'middleware' => [ 'auth' ] |
|
| 105 | 105 | ]); |
| 106 | 106 | |
| 107 | 107 | Route::post('/api/clockwork', [ |
| 108 | 108 | 'uses' => 'ClockworkController@sendTextMessage', |
| 109 | - 'middleware' => ['auth'] |
|
| 109 | + 'middleware' => [ 'auth' ] |
|
| 110 | 110 | ]); |
| 111 | 111 | |
| 112 | 112 | Route::get('/api/aviary', [ |
| 113 | 113 | 'uses' => 'AviaryController@getPage', |
| 114 | 114 | 'as' => 'api.aviary', |
| 115 | - 'middleware' => ['auth'] |
|
| 115 | + 'middleware' => [ 'auth' ] |
|
| 116 | 116 | ]); |
| 117 | 117 | |
| 118 | 118 | Route::get('/api/lob', [ |
| 119 | 119 | 'uses' => 'LobController@getPage', |
| 120 | 120 | 'as' => 'api.lob', |
| 121 | - 'middleware' => ['auth'] |
|
| 121 | + 'middleware' => [ 'auth' ] |
|
| 122 | 122 | ]); |
| 123 | 123 | |
| 124 | 124 | Route::get('/api/slack', [ |
| 125 | 125 | 'uses' => 'SlackController@getPage', |
| 126 | 126 | 'as' => 'api.slack', |
| 127 | - 'middleware' => ['auth'] |
|
| 127 | + 'middleware' => [ 'auth' ] |
|
| 128 | 128 | ]); |
| 129 | 129 | |
| 130 | 130 | Route::get('/api/facebook', [ |
| 131 | 131 | 'uses' => 'FacebookController@getPage', |
| 132 | 132 | 'as' => 'api.facebook', |
| 133 | - 'middleware' => ['auth'] |
|
| 133 | + 'middleware' => [ 'auth' ] |
|
| 134 | 134 | ]); |
| 135 | 135 | |
| 136 | 136 | Route::get('/api/linkedin', [ |
| 137 | 137 | 'uses' => 'LinkedInController@getPage', |
| 138 | 138 | 'as' => 'api.linkedin', |
| 139 | - 'middleware' => ['auth'] |
|
| 139 | + 'middleware' => [ 'auth' ] |
|
| 140 | 140 | ]); |
| 141 | 141 | |
| 142 | 142 | Route::post('/slack/message', [ |
| 143 | 143 | 'uses' => 'SlackController@sendMessageToTeam', |
| 144 | 144 | 'as' => 'slack.message', |
| 145 | - 'middleware' => ['auth'] |
|
| 145 | + 'middleware' => [ 'auth' ] |
|
| 146 | 146 | ]); |
| 147 | 147 | |
| 148 | 148 | Route::post('/tweet/new', [ |
| 149 | 149 | 'uses' => 'TwitterController@sendTweet', |
| 150 | 150 | 'as' => 'tweet.new', |
| 151 | - 'middleware' => ['auth'] |
|
| 151 | + 'middleware' => [ 'auth' ] |
|
| 152 | 152 | ]); |
| 153 | 153 | |
| 154 | 154 | Route::get('/login', [ |
| 155 | 155 | 'uses' => 'Auth\AuthController@getLogin', |
| 156 | 156 | 'as' => 'auth.login', |
| 157 | - 'middleware' => ['guest'] |
|
| 157 | + 'middleware' => [ 'guest' ] |
|
| 158 | 158 | ]); |
| 159 | 159 | |
| 160 | 160 | Route::post('/login', [ |
| 161 | 161 | 'uses' => 'Auth\AuthController@postLogin', |
| 162 | - 'middleware' => ['guest'] |
|
| 162 | + 'middleware' => [ 'guest' ] |
|
| 163 | 163 | ]); |
| 164 | 164 | |
| 165 | 165 | // Password Reset Routes... |
@@ -173,50 +173,50 @@ discard block |
||
| 173 | 173 | Route::get('/account', [ |
| 174 | 174 | 'uses' => 'AccountController@getAccountPage', |
| 175 | 175 | 'as' => 'account.dashboard', |
| 176 | - 'middleware' => ['auth'] |
|
| 176 | + 'middleware' => [ 'auth' ] |
|
| 177 | 177 | ]); |
| 178 | 178 | |
| 179 | 179 | Route::post('/account/profile', [ |
| 180 | 180 | 'uses' => 'AccountController@updateProfile', |
| 181 | 181 | 'as' => 'account.profile', |
| 182 | - 'middleware' => ['auth'] |
|
| 182 | + 'middleware' => [ 'auth' ] |
|
| 183 | 183 | ]); |
| 184 | 184 | |
| 185 | 185 | Route::post('/account/photo', [ |
| 186 | 186 | 'uses' => 'AccountController@updateAvatar', |
| 187 | 187 | 'as' => 'account.avatar', |
| 188 | - 'middleware' => ['auth'] |
|
| 188 | + 'middleware' => [ 'auth' ] |
|
| 189 | 189 | ]); |
| 190 | 190 | |
| 191 | 191 | Route::post('/account/password', [ |
| 192 | 192 | 'uses' => 'AccountController@changePassword', |
| 193 | 193 | 'as' => 'account.password', |
| 194 | - 'middleware' => ['auth'] |
|
| 194 | + 'middleware' => [ 'auth' ] |
|
| 195 | 195 | ]); |
| 196 | 196 | |
| 197 | 197 | Route::post('/account/delete/now', [ |
| 198 | 198 | 'uses' => 'AccountController@deleteAccount', |
| 199 | 199 | 'as' => 'account.delete.now', |
| 200 | - 'middleware' => ['auth'] |
|
| 200 | + 'middleware' => [ 'auth' ] |
|
| 201 | 201 | ]); |
| 202 | 202 | |
| 203 | 203 | |
| 204 | 204 | Route::get('/account/confirm/delete', [ |
| 205 | 205 | 'uses' => 'AccountController@redirectToConfirmDeletePage', |
| 206 | 206 | 'as' => 'account.confirm.delete', |
| 207 | - 'middleware' => ['auth'] |
|
| 207 | + 'middleware' => [ 'auth' ] |
|
| 208 | 208 | ]); |
| 209 | 209 | |
| 210 | 210 | Route::get('/account/delete/later', [ |
| 211 | 211 | 'uses' => 'AccountController@dontDeleteAccount', |
| 212 | 212 | 'as' => 'account.dont.delete', |
| 213 | - 'middleware' => ['auth'] |
|
| 213 | + 'middleware' => [ 'auth' ] |
|
| 214 | 214 | ]); |
| 215 | 215 | |
| 216 | 216 | Route::get('/signup', [ |
| 217 | 217 | 'uses' => 'Auth\AuthController@getRegister', |
| 218 | 218 | 'as' => 'auth.register', |
| 219 | - 'middleware' => ['guest'] |
|
| 219 | + 'middleware' => [ 'guest' ] |
|
| 220 | 220 | ]); |
| 221 | 221 | |
| 222 | 222 | Route::get('logout', [ |
@@ -226,10 +226,10 @@ discard block |
||
| 226 | 226 | |
| 227 | 227 | Route::post('/signup', [ |
| 228 | 228 | 'uses' => 'Auth\AuthController@postRegister', |
| 229 | - 'middleware' => ['guest'] |
|
| 229 | + 'middleware' => [ 'guest' ] |
|
| 230 | 230 | ]); |
| 231 | 231 | |
| 232 | - Route::get('/contact', function () { |
|
| 232 | + Route::get('/contact', function() { |
|
| 233 | 233 | return view('contact'); |
| 234 | 234 | }); |
| 235 | 235 | |