| Server IP : 13.235.167.51 / Your IP : 216.73.217.116 Web Server : Apache System : Linux machinox-server 6.17.0-1013-aws #13~24.04.1-Ubuntu SMP Fri Apr 24 21:36:58 UTC 2026 aarch64 User : root ( 0) PHP Version : 8.2.29 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/app.machinox.in/app/Http/Controllers/WebService/ |
Upload File : |
<?php
namespace App\Http\Controllers\WebService;
use App\Helpers\RazorpayHelper;
use App\Http\Controllers\Controller;
use App\Models\Advertisement;
use App\Models\Boost;
use App\Models\BoostAd;
use App\Models\Transaction;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Ramsey\Uuid\Uuid;
class BoostController extends Controller
{
public function getList()
{
try {
$boost = Boost::first();
throw_if(!$boost, new Exception('Boost not found'));
return $this->sendSuccess(trans('messages.OK'), $boost);
} catch (\Throwable $th) {
return $this->sendError($th->getMessage());
}
}
public function setInfo(Request $request)
{
try {
DB::beginTransaction();
$userId = USER_ID();
$adId = $request->input('uuid');
$state = $request->input('state');
$advertise = Advertisement::where('uuid', $adId)->first();
$boost = Boost::first();
throw_if(!$advertise, new Exception(trans('messages.ADVERTISEMENT_INFO_NOT_FOUND')));
$trx = app(\App\Services\TransactionService::class)->generate([
'trx_type' => 'BOOST',
'type' => 'BOOST',
'ad_id' => $advertise->id,
'state' => $state,
'boost' => $boost,
]);
DB::commit();
return $this->sendSuccess(trans('messages.OK'), [
'trx_id' => $trx->uuid,
'order_id' => $trx->trx_id,
'taxes' => $trx->tax_amount,
'tax_percent' => $trx->taxes,
'amount' => $trx->grand_total,
'currency' => $trx->currency,
'razorpay_key' => config('services.razorpay.key'),
]);
} catch (\Throwable $th) {
return $this->sendError($th->getMessage());
}
}
}