add change avatar

This commit is contained in:
2025-07-13 09:44:22 +03:30
parent 87487dd5f9
commit 9ab439c5d0
9 changed files with 72 additions and 62 deletions

View File

@@ -36,7 +36,7 @@ class CallController extends Controller
{
$call = DB::transaction(function () use ($request)
{
$operator = User::query()->where('telephone_id', $request->extension)->first();
$operator = User::query()->where('telephone_id', '=', $request->extension)->first();
$call = Call::query()->create([
'telephone_id' => $request->extension,
@@ -46,7 +46,7 @@ class CallController extends Controller
'operator_full_name' => $operator->full_name
]);
CallHistory::recordHistory($call, CallEvents::CALL_CREATED);
CallHistory::recordHistory($call, CallEvents::CALL_CREATED->value);
return $call;
});
@@ -63,17 +63,17 @@ class CallController extends Controller
}
catch (NotificationServerNotRespondingException $exception)
{
CallHistory::recordHistory($call, CallEvents::NOTIFICATION_SERVER_NOT_RESPONDING);
CallHistory::recordHistory($call, CallEvents::NOTIFICATION_SERVER_NOT_RESPONDING->value);
throw $exception;
}
catch (OperatorOfflineException $exception)
{
CallHistory::recordHistory($call, CallEvents::OPERATOR_IS_OFFLINE);
CallHistory::recordHistory($call, CallEvents::OPERATOR_IS_OFFLINE->value);
throw $exception;
}
catch (OperatorNotConnectedException $exception)
{
CallHistory::recordHistory($call, CallEvents::OPERATOR_COULD_NOT_CONNECT);
CallHistory::recordHistory($call, CallEvents::OPERATOR_COULD_NOT_CONNECT->value);
throw $exception;
}
}
@@ -81,11 +81,11 @@ class CallController extends Controller
public function update(UpdateRequest $request, Call $call): JsonResponse
{
DB::transaction(function () use ($request, $call) {
$operator = User::query()->where('telephone_id', $call->telephone_id)->first();
$operator = User::query()->where('telephone_id', '=', $call->telephone_id)->first();
$category = Category::query()->where([
['category_id', $request->category_id],
['subcategory_id', $request->subcategory_id]
['category_id', '=', $request->category_id],
['subcategory_id', '=', $request->subcategory_id]
])->first();
$call->update([
@@ -101,7 +101,7 @@ class CallController extends Controller
'description' => $request->description,
]);
$event_id = CallEvents::OPERATOR_STORED_CALL_DATA;
$event_id = CallEvents::OPERATOR_STORED_CALL_DATA->value;
$event_name = Event::query()->find($event_id)->first()->name;
@@ -123,9 +123,8 @@ class CallController extends Controller
$size = $request->size ?? config('global_variables.MAX_RECORDS_COUNT');
$calls_data = Call::query()
->when($phone_number, function ($query) use ($phone_number) {
return $query->where('caller_phone_number', $phone_number);
})->orderBy('created_at', 'DESC')
->when($phone_number, fn($query, $phone_number) => $query->where('phone_number', '=', $phone_number))
->orderBy('created_at', 'DESC')
->limit($size)
->get();