Edit File: CallService.php
<?php namespace App\Services; use Carbon\Carbon; use App\Traits\LogException; use App\Services\LiveVideo\LiveVideoService; class CallService { use LogException; // for User order ONLY public function makeCall($model, $user_id, $order_id, $order_type = null) { $order = $model::where($user_id, auth()->id())->findOrFail($order_id); if ($order->provider->is_busy || $order->user->is_busy) { return [ 'key' => 'fail', 'msg' => __('apis.one_of_this_users_is_busy'), 'data' => [] ]; } $live = new LiveVideoService(); $results = $live->createTokenForLiveAuction(); $order->update([ 'api_key' => $results['data']['api_key'], 'secret_key' => $results['data']['api_secret'], 'session_id' => $results['data']['session_id'], 'token' => $results['data']['token'], ]); return [ 'key' => 'success', 'msg' => __('apis.your_call_has_started'), 'data' => array_merge($results['data'], [ 'order_id' => $order->id, 'order_type' => $order_type ]) ]; } }
Back to File Manager