fix clied password nd fix rote for expert

This commit is contained in:
2026-06-01 16:36:02 +03:30
parent 69ffe322ce
commit 675d2bdbad
2 changed files with 10 additions and 15 deletions

View File

@@ -28,8 +28,7 @@ class GatewayManagementController extends Controller
$request, $request,
allowedFilters: ['*'], allowedFilters: ['*'],
allowedSortings: ['*'], allowedSortings: ['*'],
allowedSelects: ['id', 'name', 'domain', 'tax_id', 'bank_name', 'account_holder', 'iban', allowedSelects: ['*'],
'business_type_id', 'business_type_name','created_at', 'status'],
); );
} }
@@ -44,11 +43,12 @@ class GatewayManagementController extends Controller
? FileFacade::save($request->file('logo'), "{$user->id}") ? FileFacade::save($request->file('logo'), "{$user->id}")
: null; : null;
$result = DB::transaction(function () use ($user, $logo, $request) { $passportClient = DB::transaction(function () use ($user, $logo, $request) {
$client = app(ClientRepository::class)
->createClientCredentialsGrantClient($request->name);
$gateway = UserGateway::query()->create([ $clientName = "Gateway {$request->name} - User {$user->id}";
$client = app(ClientRepository::class)->createPasswordGrantClient($clientName, 'users');
UserGateway::query()->create([
'user_id' => $user->id, 'user_id' => $user->id,
'username' => $user->username, 'username' => $user->username,
'name' => $request->name, 'name' => $request->name,
@@ -60,23 +60,18 @@ class GatewayManagementController extends Controller
'business_type_id' => $request->business_type_id, 'business_type_id' => $request->business_type_id,
'business_type_name' => BusinessTypeEnum::name($request->business_type_id), 'business_type_name' => BusinessTypeEnum::name($request->business_type_id),
'logo' => $logo, 'logo' => $logo,
// save Passport client info in your own table
'client_id' => $client->id, 'client_id' => $client->id,
'client_secret' => $client->secret, 'client_secret' => $client->secret,
]); ]);
$user->update(['authority_level' => 1]); $user->update(['authority_level' => 1]);
return [ return $client;
'gateway' => $gateway,
'client' => $client,
];
}); });
return $this->successResponse([ return $this->successResponse([
'client_id' => $result['client']->id, 'client_id' => $passportClient->id,
'client_secret' => $result['client']->secret, 'client_secret' => $passportClient->secret,
]); ]);
} }
public function show(UserGateway $gateway): JsonResponse public function show(UserGateway $gateway): JsonResponse

View File

@@ -77,7 +77,7 @@ Route::prefix('expert')
Route::prefix('profile') Route::prefix('profile')
->name('profile.') ->name('profile.')
->middleware('auth') ->middleware('auth:expert')
->controller(ProfileController::class) ->controller(ProfileController::class)
->group(function () { ->group(function () {
Route::get('info', 'info')->name('info'); Route::get('info', 'info')->name('info');