ChangeController.php
646 Bytes
<?php
namespace App\Http\Container\AppSection\Controllers\Auth;
use App\Helpers\JsonResource;
use App\Http\Container\AppSection\Requests\ChangePhoneRequest;
use App\Models\User;
use App\Support\Controller;
use Auth;
class ChangeController extends Controller
{
/**
* @param \App\Http\Container\AppSection\Requests\ChangePhoneRequest $request
*/
public function phone(ChangePhoneRequest $request)
{
User::query()->whereKey(Auth::id())->update(['area_code' => $request->phoneNumber->getIDDCode(), 'phone' => $request->phoneNumber->getNumber()]);
return JsonResource::success(JsonResource::SUCCESS);
}
}