Run multiple websites using the same Laravel installation while keeping tenant specific data separated for fully independent multi-domain setups, previously github.com/hyn/multi-tenant
Create a class which extends Laravel\Sanctum\PersonalAccessToken and apply the trait.
In this example I've created Token class in App\Models\Auth
namespace App\Models\Auth\Token;
use Hyn\Tenancy\Traits\UsesTenantConnection;
use Laravel\Sanctum\PersonalAccessToken;
class Token extends PersonalAccessToken
{
use UsesTenantConnection;
protected $table = 'personal_access_tokens';
}
finally in your AppServiceProvider:
use Hyn\Tenancy\Events\Websites\Switched;
use App\Models\Auth\Token;
...
public function boot()
{
Event::listen(Switched::class, function (Switched $event) {
Sanctum::usePersonalAccessTokenModel(Token::class);
});
}
Description of your feature
Sanctum integration guide
Information
Create a class which extends
Laravel\Sanctum\PersonalAccessToken
and apply the trait. In this example I've createdToken
class inApp\Models\Auth
finally in your AppServiceProvider:
That's all.