This repository was archived by the owner on Oct 24, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +23
-21
lines changed
Expand file tree Collapse file tree 3 files changed +23
-21
lines changed Original file line number Diff line number Diff line change @@ -18,18 +18,11 @@ class FetchController extends Controller
1818 /**
1919 * Set up Guzzle Client for requests
2020 *
21- * @return void
21+ * @param Client $client
2222 */
23- public function __construct ()
23+ public function __construct (Client $ client )
2424 {
25- $ this ->client = new Client (
26- [
27- 'headers ' => [
28- 'User-Agent ' => env ('REDDIT_USER_AGENT ' ),
29- 'Content-Type ' => 'application/x-www-form-urlencoded ' ,
30- ]
31- ]
32- );
25+ $ this ->client = $ client ;
3326 $ this ->access_token = '' ;
3427 $ this ->results = [];
3528 }
@@ -174,7 +167,7 @@ private function notifySlack()
174167 'elements ' => [
175168 [
176169 'type ' => 'mrkdwn ' ,
177- 'text ' => '<https://mod.reddit.com/mail/|View Modmail> ' ,
170+ 'text ' => '<https://mod.reddit.com/mail/all|Open Modmail> to view all messages ' ,
178171 ]
179172 ]
180173 ];
Original file line number Diff line number Diff line change 22
33namespace App \Providers ;
44
5+ use GuzzleHttp \Client ;
56use Illuminate \Support \ServiceProvider ;
67
78class AppServiceProvider extends ServiceProvider
89{
9- /**
10- * Register any application services.
11- *
12- * @return void
13- */
14- public function register ()
15- {
16- //
17- }
10+ /**
11+ * Register any application services.
12+ *
13+ * @return void
14+ */
15+ public function register ()
16+ {
17+ $ this ->app ->singleton (Client::class, function ($ app ) {
18+ $ client = new Client ([
19+ 'headers ' => [
20+ 'User-Agent ' => env ('REDDIT_USER_AGENT ' ),
21+ 'Content-Type ' => 'application/x-www-form-urlencoded ' ,
22+ ]
23+ ]);
24+ return $ client ;
25+ });
26+ }
1827}
Original file line number Diff line number Diff line change 7676|
7777*/
7878
79- // $app->register(App\Providers\AppServiceProvider::class);
79+ $ app ->register (App \Providers \AppServiceProvider::class);
8080// $app->register(App\Providers\AuthServiceProvider::class);
8181// $app->register(App\Providers\EventServiceProvider::class);
8282
You can’t perform that action at this time.
0 commit comments