Skip to content

Commit

Permalink
feat: add config prefix for route on this package
Browse files Browse the repository at this point in the history
  • Loading branch information
tanhongit committed Nov 23, 2023
1 parent d7cb783 commit ff5fdd4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
3 changes: 3 additions & 0 deletions config/telegram-git-notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
base_path('resources/views/vendor/tg-notifier')
),
],

// Set route prefix for telegram git notifier app
'route_prefix' => env('TGN_DEFAULT_ROUTE_PREFIX', 'telegram-git-notifier'),
],

'app' => [
Expand Down
16 changes: 9 additions & 7 deletions routes/bot.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
|
*/

Route::prefix('telegram-git-notifier')->group(function () {
Route::any('/', [IndexAction::class, 'index'])->name('telegram-git-notifier.index');
$routePrefix = config('telegram-git-notifier.defaults.route_prefix');

Route::prefix('webhook')->group(function () {
Route::get('/set', [WebhookAction::class, 'set'])->name('telegram-git-notifier.webhook.set');
Route::get('/delete', [WebhookAction::class, 'delete'])->name('telegram-git-notifier.webhook.delete');
Route::get('/info', [WebhookAction::class, 'getWebHookInfo'])->name('telegram-git-notifier.webhook.info');
Route::get('/updates', [WebhookAction::class, 'getUpdates'])->name('telegram-git-notifier.webhook.updates');
Route::prefix($routePrefix)->group(function () use ($routePrefix) {
Route::match(['get', 'post'], '/', IndexAction::class)->name("$routePrefix.index");

Route::prefix('webhook')->group(function () use ($routePrefix) {
Route::get('set', [WebhookAction::class, 'set'])->name("$routePrefix.webhook.set");
Route::get('delete', [WebhookAction::class, 'delete'])->name("$routePrefix.webhook.delete");
Route::get('info', [WebhookAction::class, 'getWebHookInfo'])->name("$routePrefix.webhook.info");
Route::get('updates', [WebhookAction::class, 'getUpdates'])->name("$routePrefix.webhook.updates");
});
});

0 comments on commit ff5fdd4

Please sign in to comment.