You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use your filament-saas-panel and jump to after successful registration. http://saas.test/admin/team/23
But the page shows 404.
What could possibly be the problem? Thank you.
How to reproduce the bug
<?php
namespace App\Providers\Filament;
use Filament\Http\Middleware\Authenticate;
use Filament\Http\Middleware\DisableBladeIconComponents;
use Filament\Http\Middleware\DispatchServingFilamentEvent;
use Filament\Pages;
use Filament\Panel;
use Filament\PanelProvider;
use Filament\Support\Colors\Color;
use Filament\Widgets;
use App\Filament\Pages\Tenancy\RegisterTeam;
use App\Filament\Pages\Tenancy\EditTeamProfile;
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
use Illuminate\Cookie\Middleware\EncryptCookies;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\Session\Middleware\AuthenticateSession;
use Illuminate\Session\Middleware\StartSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;
use TomatoPHP\FilamentSaasPanel\Models\Team;
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('admin')
->path('admin')
->login()
->colors([
'primary' => '#15c883',
])
->brandName('Filament Demo')
->tenant(Team::class)
->tenantRoutePrefix('team')
// ->requiresTenantSubscription()
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
->pages([
Pages\Dashboard::class,
])
->plugins([\Shebaoting\FilamentPlugins\FilamentPluginsPlugin::make()->useUI(false), \TomatoPHP\FilamentAccounts\FilamentAccountsPlugin::make(), \TomatoPHP\FilamentSaasPanel\FilamentSaasPanelPlugin::make()
->editTeam()
->deleteTeam()
->showTeamMembers()
->teamInvitation()
->allowTenants()
->checkAccountStatusInLogin()
->APITokenManager()
->editProfile()
->editPassword()
->browserSessionManager()
->deleteAccount()
->editProfileMenu()
->registration()
->useOTPActivation()])
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
->widgets([
Widgets\AccountWidget::class,
Widgets\FilamentInfoWidget::class,
])
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authMiddleware([
Authenticate::class,
])
->viteTheme('resources/css/filament/admin/theme.css')
->spa();
}
}
app/Models/Account.php
<?php
namespace App\Models;
use Filament\Models\Contracts\FilamentUser;
use Filament\Models\Contracts\HasAvatar;
use Filament\Models\Contracts\HasTenants;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
use TomatoPHP\FilamentSaasPanel\Traits\InteractsWithTenant;
use TomatoPHP\FilamentSaasPanel\Models\Team;
use Filament\Panel;
use Illuminate\Support\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
/**
* @property int $id
* @property string $name
* @property string $username
* @property string $loginBy
* @property string $type
* @property string $address
* @property string $password
* @property string $otp_code
* @property string $otp_activated_at
* @property string $last_login
* @property string $agent
* @property string $host
* @property int $attempts
* @property bool $login
* @property bool $activated
* @property bool $blocked
* @property string $deleted_at
* @property string $created_at
* @property string $updated_at
*/
class Account extends Authenticatable implements FilamentUser, HasAvatar, HasMedia, HasTenants
{
use HasFactory;
use InteractsWithMedia;
use InteractsWithTenant;
use Notifiable;
use SoftDeletes;
/**
* @var array
*/
protected $fillable = [
'email',
'phone',
'parent_id',
'type',
'name',
'username',
'loginBy',
'address',
'password',
'otp_code',
'otp_activated_at',
'last_login',
'agent',
'host',
'is_login',
'is_active',
'deleted_at',
'created_at',
'updated_at',
];
protected $casts = [
'is_login' => 'boolean',
'is_active' => 'boolean',
];
protected $dates = [
'deleted_at',
'created_at',
'updated_at',
'otp_activated_at',
'last_login',
];
protected $hidden = [
'password',
'remember_token',
'otp_code',
'otp_activated_at',
'host',
'agent',
];
public function getFilamentAvatarUrl(): ?string
{
return $this->getFirstMediaUrl('avatar') ?? null;
}
public function getDefaultTenant(Panel $panel): ?Model
{
return $this->latestTeam;
}
/**
* 用户与团队的多对多关系
*
* @return BelongsToMany
*/
public function teams(): BelongsToMany
{
return $this->belongsToMany(Team::class);
}
/**
* 获取用户所属的所有租户(团队)
*
* @param Panel $panel
* @return Collection
*/
public function getTenants(Panel $panel): Collection
{
return $this->teams;
}
/**
* 验证用户是否可以访问特定租户
*
* @param Model $tenant
* @return bool
*/
public function canAccessTenant(Model $tenant): bool
{
return $this->teams()->whereKey($tenant)->exists();
}
/**
* 判断用户是否可以访问 Filament 面板
*
* @param Panel $panel
* @return bool
*/
public function canAccessPanel(Panel $panel): bool
{
// 根据您的权限逻辑决定用户是否可以访问面板
// 例如,可以基于用户角色或权限
// 这里简单返回 true,允许所有已认证用户访问
return true;
}
public function latestTeam(): BelongsTo
{
return $this->belongsTo(Team::class, 'latest_team_id');
}
}
Package Version
1.0.0
PHP Version
8.3
Laravel Version
11
Which operating systems does with happen with?
macOS
Notes
No response
The text was updated successfully, but these errors were encountered:
What happened?
I use your filament-saas-panel and jump to after successful registration.
http://saas.test/admin/team/23
But the page shows 404.
What could possibly be the problem? Thank you.
How to reproduce the bug
app/Models/Account.php
Package Version
1.0.0
PHP Version
8.3
Laravel Version
11
Which operating systems does with happen with?
macOS
Notes
No response
The text was updated successfully, but these errors were encountered: