Added webhook to capture incoming webhooks

This commit is contained in:
Deon George 2023-05-06 21:48:46 +10:00
parent 013bb632d3
commit a32e8e9d05
3 changed files with 23 additions and 2 deletions

View File

@ -2,9 +2,17 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class WelcomeController extends Controller class WelcomeController extends Controller
{ {
public function home() { public function home() {
return view('welcome.home'); return view('welcome.home');
} }
public function webhook(Request $request)
{
Log::channel('webhook')->debug('Webhook event',['request'=>$request]);
}
} }

View File

@ -54,6 +54,12 @@ return [
'days' => 14, 'days' => 14,
], ],
'webhook' => [
'driver' => 'daily',
'path' => storage_path('logs/webhook.log'),
'level' => env('LOG_LEVEL', 'debug'),
],
'slack' => [ 'slack' => [
'driver' => 'slack', 'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'), 'url' => env('LOG_SLACK_WEBHOOK_URL'),

View File

@ -1,6 +1,10 @@
<?php <?php
use App\Http\Controllers\{AdminController,CheckoutController,ProductController,ResellerServicesController}; use App\Http\Controllers\{AdminController,
CheckoutController,
ProductController,
ResellerServicesController,
WelcomeController};
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -30,4 +34,7 @@ Route::group(['middleware'=>['auth:api','role:reseller']], function() {
Route::group(['middleware'=>'auth:api'], function() { Route::group(['middleware'=>'auth:api'], function() {
Route::post('/u/checkout/fee/{o}',[CheckoutController::class,'fee']) Route::post('/u/checkout/fee/{o}',[CheckoutController::class,'fee'])
->where('o','[0-9]+'); ->where('o','[0-9]+');
}); });
Route::any('/intuit/webhook',[WelcomeController::class,'webhook'])
->where('o','[0-9]+');