File tree Expand file tree Collapse file tree 3 files changed +42
-4
lines changed Expand file tree Collapse file tree 3 files changed +42
-4
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,44 @@ INSTAGRAM_CLIENT_ID=your-client-id
8989INSTAGRAM_CLIENT_SECRET=your-client-secret
9090```
9191
92+ ## Overriding the default routes
93+
94+ If you want to override the default routes, you can do so by creating a ` instagram.php ` file in your routes directory and adding the following code:
95+
96+ ``` php
97+ <?php
98+
99+ use CodebarAg\LaravelInstagram\Http\Controllers\InstagramController;
100+ use Illuminate\Support\Facades\Route;
101+
102+ Route::prefix('instagram')->name('instagram.')->group(function () {
103+ Route::get('/auth', [InstagramController::class, 'auth'])->name('auth');
104+
105+ Route::get('/callback', [InstagramController::class, 'callback'])->name('callback');
106+ });
107+ ```
108+
109+ Then you should register the routes in your ` bootstrap\app.php ` :
110+
111+ ``` php
112+ ->withRouting(
113+ web: __DIR__ . '/../routes/web.php',
114+ // api: __DIR__ . '/../routes/api.php',
115+ then: function () {
116+ Route::middleware('web')->group(base_path('routes/instagram.php'));
117+ },
118+ )
119+ ```
120+
121+ or in your ` RouteServiceProvider ` :
122+
123+ ``` php
124+ $this->routes(function () {
125+ Route::middleware('web')->group(base_path('routes/web.php'));
126+ Route::middleware('web')->group(base_path('routes/instagram.php'));
127+ });
128+ ```
129+
92130You can get your client id and client secret by registering your app on the [ Instagram Developer Portal] ( https://developers.facebook.com/docs/instagram-platform/instagram-api-with-instagram-login )
93131
94132When configuring your app on the Instagram Developer Portal, you will need to set the redirect uri to: ` http://your-app-url.com/instagram/callback `
Original file line number Diff line number Diff line change 77 Route::get ('/auth ' , [InstagramController::class, 'auth ' ])->name ('auth ' );
88
99 Route::get ('/callback ' , [InstagramController::class, 'callback ' ])->name ('callback ' );
10-
11- Route::get ('/me ' , [InstagramController::class, 'me ' ])->name ('me ' );
12-
13- Route::get ('/media ' , [InstagramController::class, 'media ' ])->name ('media ' );
1410});
Original file line number Diff line number Diff line change 11<?php
22
33use CodebarAg \LaravelInstagram \Tests \TestCase ;
4+ use Illuminate \Support \Sleep ;
45use Saloon \Config ;
6+ use Saloon \Http \Faking \MockClient ;
7+ use Saloon \Laravel \Facades \Saloon ;
58
69Config::preventStrayRequests ();
710
811uses (TestCase::class)
12+ ->beforeEach (fn () => MockClient::destroyGlobal ())
913 ->in (__DIR__ );
You can’t perform that action at this time.
0 commit comments