For customizing the subscription description, you can use the createSubscription method in the SubscriptionBuilder class. You can pass the metadata parameter to this method to set the description. Here's an example:
use Laravel\Spark\SubscriptionBuilder;
$builder = new SubscriptionBuilder($user, $plan);
$builder->createSubscription($paymentMethod, [
'metadata' => [
'description' => 'Custom subscription description'
]
]);
As for modifying Spark code, it's generally not recommended to modify the vendor package directly. Instead, you can extend the Spark classes and override the methods that you need to modify. You can place these extended classes in your own app's namespace.
For example, if you want to modify the SubscriptionBuilder class, you can create a new class in your app's namespace that extends the original class:
namespace App;
use Laravel\Spark\SubscriptionBuilder as SparkSubscriptionBuilder;
class SubscriptionBuilder extends SparkSubscriptionBuilder
{
// Override methods here
}
Then, you can use your extended class instead of the original one:
use App\SubscriptionBuilder;
$builder = new SubscriptionBuilder($user, $plan);
$builder->createSubscription($paymentMethod);