Skip to content

Instantly share code, notes, and snippets.

@neverything
Created December 16, 2023 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neverything/a226c0f24d5c1716fc62b17b47d1e63c to your computer and use it in GitHub Desktop.
Save neverything/a226c0f24d5c1716fc62b17b47d1e63c to your computer and use it in GitHub Desktop.
⚠️ Don't do it this way. Read about it on my blog https://silvanhagen.com/free-users-filament-laravel-spark/
<?php
namespace App\Filament\Resources;
// use ...
class FeedbackResource extends Resource
{
// ... rest of the class
public static function isTenantSubscriptionRequired(Panel $panel): bool
{
$path = request()->path();
if (! preg_match('/project\/(\d+)/', $path, $matches)) {
return true;
}
$tenant = $panel->getTenantModel()::findOrFail(intval($matches[1]));
return $tenant->isBillable();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment