Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

AdrianB's avatar
Level 11

Rename Teams to Companies in Spark

Has anyone had any experience in renaming Teams to something else like "Company", "School", "Class", "Group", "Circle", "Organisation", etc.

I know I can rename the model, but I'd like to hear about people's experiences in changing the "team" in routes, table's and relations. It's just that the word "Team" does not at all suit the application I'm building, but the team billing concept does. It seems strange to me that the word "Team" seems so baked into Spark.

Cheers guys.

0 likes
18 replies
dtunes's avatar

Yeah, I'm on the same boat. Wondering whether or not to change everything or just the model, or maybe just the views for displaying purposes.

https://spark.laravel.com/docs/2.0/customization, you can use your own teamModel/userModel, maybe have a method on the model that returns a friendly name to your object and use that in views etc?

1 like
AdrianB's avatar
Level 11

I ended up adding Cashier to my existing project and doing it on my own. Mainly because the team billing feature wouldn't work unless you were using free trials, boss wouldn't have liked that.

Cashier, like Spark doesn't let you customise the foreign key name in the subscriptions table from user_id to in my case company_id but it lets you customise the model. I'm sure most people would be fine keeping it as user_id, it probably bothered more than it should have.

I made my own Subscription model to fix the issue:

<?php

namespace App;

use Laravel\Cashier\Subscription as BaseSubscription;

class Subscription extends BaseSubscription
{
    public function user()
    {
        $model = getenv('BRAINTREE_MODEL') ?: config('services.braintree.model');
        return $this->belongsTo($model, 'company_id');
    }

    public function company()
    {
        return $this->user();
    }

    public function getCompanyAttribute()
    {
        return $this->user;
    }
}

And lastly, add this to the company model:


    use Billable {
        subscriptions as billableSubscriptions;
    }

    public function subscriptions()
    {
        return $this->hasMany(\App\Subscription::class)->orderBy('created_at', 'desc');
    }
2 likes
accounts@uptickhr.com's avatar

I'm running into this and It seems like the answer is "deal with it" right?

For us, the rub is really that we have company accounts (which pay the subscription) and then we put teams inside there.

So it looks like we'd have to use Spark's "Team" as our account and then add our Team/Department sections on top of that. It gets muddy with how we refer to Teams and how Spark does.

AdrianB's avatar
Level 11

Trust me, ends up not worth the struggle. I just pulled the spark bits and pieces I liked into my own cashier project. Spark doesn't suit everyone's needs

3 likes
accounts@uptickhr.com's avatar

Mind me asking how you lifted the spark pieces you wanted into the cashier project?

What all did you take from Spark? (Feel free to email me) jmichaelprobert gmail

Cronix's avatar

I haven't use it, but does this work? Spark::referToTeamAs('band');

1 like
accounts@uptickhr.com's avatar

Hey Cronix - That's a useful piece to rename Teams in the front-end but all of the routes, db tables, and such will still refer to them as Teams. Makes it confusing for someone coming into the codebase fresh. Too easy to get confused.

Cronix's avatar

It updates the frontend terminology and uses whatever you reassigned it to in the routes. If you look in the spark routes file you can see it changes it for whatever text you're using instead of "team". You just need to clear the route cache after changing it. But yeah, it doesn't change db tables or models.

gstoa's avatar

In Spark/src/Configurations/ManagesAppOptions, I see:

public static $teamString = 'team'; 
sanch012's avatar

@Cronix I am trying to us the method 'Spark::referToTeamAs('what-to-call-teams');' but i receive the error Call to undefined method Laravel\Spark\Spark::referToTeamAs()?

Also when searching all files for that method it returns nothing? any ideas why that might be?

Cronix's avatar

@sanch012 Are you putting it in the booted method of the SparkServiceProvider? Some things work in the register method, but not everything. Try putting it in booted()

sanch012's avatar

@Cronix thanks for the reply. I have just tried that and I am still get the same error.

sanch012's avatar

@Cronix would it be possible that because I created my application without team and then added after, that this method is not been included?

brjohnson4's avatar

@sanch012 In Spark 6.0, you change how you refer to teams in the resources/lang/en/teams.php file.

bskimball's avatar

The answer is documented here --> https://spark.laravel.com/docs/6.0/teams

In your spark service provider add a register method

SparkServiceProvider.php

public function register()
{
    parent::register();
    Spark::prefixTeamsAs('group')
}

Then replace the instances of team in resources/lang/en/teams.php

1 like

Please or to participate in this conversation.