Skip to content

Commit 807c569

Browse files
committed
WIP
1 parent 549a0a2 commit 807c569

File tree

3 files changed

+42
-4
lines changed

3 files changed

+42
-4
lines changed

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,44 @@ INSTAGRAM_CLIENT_ID=your-client-id
8989
INSTAGRAM_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+
92130
You 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

94132
When configuring your app on the Instagram Developer Portal, you will need to set the redirect uri to: `http://your-app-url.com/instagram/callback`

routes/instagram.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,4 @@
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
});

tests/Pest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
<?php
22

33
use CodebarAg\LaravelInstagram\Tests\TestCase;
4+
use Illuminate\Support\Sleep;
45
use Saloon\Config;
6+
use Saloon\Http\Faking\MockClient;
7+
use Saloon\Laravel\Facades\Saloon;
58

69
Config::preventStrayRequests();
710

811
uses(TestCase::class)
12+
->beforeEach(fn () => MockClient::destroyGlobal())
913
->in(__DIR__);

0 commit comments

Comments
 (0)