I am trying to play a bit around with Laravel Spark, and as a test I'd like to override the "Create API Token" request.
I notice the endpoint being used, when a user should create an API token is this:
POST | settings/api/token | Laravel\Spark\Http\Controllers\Settings\API\TokenController@store
So according to their guide on customization you should use their Spark::swap
method.
So I have tried adding below piece of code into SparkServiceProivder@booted
, but it doesn't seem to work:
use Laravel\Spark\Http\Controllers\Settings\API\TokenController;
use Laravel\Spark\Http\Requests\Settings\API\CreateTokenRequest;
Spark::swap(
TokenController::class . '@store',
function(CreateTokenRequest $request) {
exit('Hello World');
}
);
What am I doing wrong?