In the old Laravel Spark (now Spark Classic) you could utilise a configuration method Spark::prefixTeamsAs('bands'); a new project I'm working on uses the new Laravel Spark which is now more of a billing conduit and allows team management to be taken care of by Laravel Jetstream. Does Laravel Jetstream support referring to teams by other labels?
Is it possible to rename Teams in Laravel Jetstream?
569 Views Asked by Grant At
2
There are 2 best solutions below
0
On
I looked to see if there was a built in feature and found a lot of people like you looking for a solution with answers with terrible solutions. Here is what I did that works better than all the solutions provided. The only downside/upside is the functions of JetStream will obviously still call it Teams. I removed my default built App\Models\Team and replaced it with in my case Projects and overrided the default table naming convention, for you can be Bands:
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Laravel\Jetstream\Events\TeamCreated;
use Laravel\Jetstream\Events\TeamDeleted;
use Laravel\Jetstream\Events\TeamUpdated;
use Laravel\Jetstream\Team as JetstreamTeam;
class Bands extends JetstreamTeam
{
use HasFactory;
public $table="bands";
}
Jetstream doesn't have built-in support for renaming Teams. I worked around this by publishing the views and renaming Team in the applicable view files. I haven't overrode the routing yet, so my Teams related paths still have team in the URL.