A lot of things.
This commit is contained in:
29
app/Http/Controllers/WebhookController.php
Normal file
29
app/Http/Controllers/WebhookController.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Entry;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class WebhookController extends Controller
|
||||
{
|
||||
|
||||
public function XenForoNewPost(Request $request)
|
||||
{
|
||||
|
||||
if( $request->header('XF-Webhook-Secret') !== env('WEBHOOK_SECRET') )
|
||||
abort(403);
|
||||
|
||||
$threadId = $request->input('data.thread_id');
|
||||
if( $threadId ){
|
||||
$entry = Entry::where('comments_thread_id', $threadId)->first();
|
||||
if( $entry ){
|
||||
Cache::forget("entry_comments_{$entry->id}");
|
||||
}
|
||||
}
|
||||
|
||||
return response()->json(['success' => true]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user