Skip to content

Commit

Permalink
discord notification when new app submited
Browse files Browse the repository at this point in the history
  • Loading branch information
3x1io committed Mar 30, 2024
1 parent 5775dbc commit 14466c2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Modules/CircleApps/App/Http/Controllers/CircleAppsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Modules\CircleApps\App\Http\Controllers;

use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
Expand Down Expand Up @@ -71,11 +72,20 @@ public function store(Request $request)
$app->is_free = true;
$app->save();


$app->addMedia($request->file('logo'))->toMediaCollection('logo');
$app->addMedia($request->file('cover'))->toMediaCollection('cover');
$app->addMedia($request->file('module'))->toMediaCollection('module');

try {
$user = User::first();
$user->notifyDiscord(
title: "=========== New CircleXO App Submit =========== \n".' NAME: '.$app->name . " \n DESCRIPTION: " . $app->description . " \n BY: " . $app->account->username . " \n MODULE: " . $app->getMedia('module')->first()?->getUrl() ,
webhook: config('services.discord.notification-webhook')
);
}catch (\Exception $exception){
// do nothing
}

Toast::success(__('App submitted successfully!'))->autoDismiss(2);
return back();
}
Expand Down

0 comments on commit 14466c2

Please sign in to comment.