diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 1fe21eb..59b5433 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -5,11 +5,13 @@ namespace App\Providers; use App\Filament\Pages\Auth\Settings; +use App\Models\User; use Carbon\Carbon; use Filament\Facades\Filament; use Filament\Navigation\UserMenuItem; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\File; +use Illuminate\Support\Facades\Gate; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider @@ -52,6 +54,10 @@ public function boot() ->icon('heroicon-o-cog'), ]); }); + + Gate::define('viewApiDocs', function (User $user) { + return $user->canAccessFilament() && $user->isPlatformAdmin(); + }); } public function registerReleaseVersion(): void diff --git a/routes/api.php b/routes/api.php index f507d14..3a7363a 100644 --- a/routes/api.php +++ b/routes/api.php @@ -17,7 +17,6 @@ | is assigned the "api" middleware group. Enjoy building your API! | */ -Gate::define('viewApiDocs', fn () => true); Route::middleware('auth:sanctum') ->prefix('/v1')