@maxdiable It looks like you've set up your PersonalAccessToken model to use the "oracle_1" connection and specified it in your AppServiceProvider, but you're not specifying the connection in your API routes. To fix this, you can add the connection to your API routes by using the on method:
Route::middleware('auth:sanctum')->group(function () {
Route::on('oracle_1')->apiResource('operatori', OperatoriController::class);
});
This tells Laravel to use the "oracle_1" connection when handling requests to the "operatori" routes.
You can also use on method on your personal access token model to use the different connection for a different tokens if you have different token tables on a different connection
class PersonalAccessToken extends SanctumPersonalAccessToken {
protected $connection = "oracle_1";
protected $table = 'personal_access_tokens';
}
class OtherPersonalAccessToken extends SanctumPersonalAccessToken {
protected $connection = "oracle_2";
protected $table = 'other_personal_access_tokens';
}
Sanctum::usePersonalAccessTokenModel( OtherPersonalAccessToken::class, 'other_connection' );
This way you can use the different connections for the different token tables.