Issue with Form Validation after Conditionally Hiding Pages in Filament

I'm currently facing an issue in my Filament project, and it seems to persist in the official Filament 3 demo project as well. I would greatly appreciate your insights and assistance. What I am trying to do I followed the Filament 3 documentation to conditionally hide pages in the navigation, intending to control user access to specific pages. The hiding functionality is working as expected and it gives 403 error page when try to access that URL. What I did I implemented the conditional hiding logic in my user model as per the documentation public function canAddTopAds(): bool { $package_id = DB::table('payments')->select('package_id')->where('v_id', '=', Auth::id())->value('package_id'); $top_ads_limit = DB::table('payments')->select('top_ads_count')->where('v_id', '=', Auth::id())->value('top_ads_count'); $Ads_Count = DB::table('advertisements')->select('id')->where('v_id', '=', Auth::id())->where('ad_type', '=', 1)->count(); if($Ads_Count < $top_ads_limit){ return true; }else{ return false; } } And in the CreateVendorTopAd resource page public function mount(): void { abort_unless(auth()->user()->canAddTopAds(), 403); } My issue/the error Scenario: I have a conditional check in my user model to control page access based on certain conditions. The CreateVendorTopAd page successfully restricts access when the condition is not met (403 error). However, when the condition is met, the form on the CreateVendorTopAd page does not validate correctly. Specifically, fields like Filament\Forms\Components\Hidden, Forms\Components\RichEditor, and Forms\Components\Select trigger validation errors, while Forms\Components\TextInput does not. I suspect there might be a conflict or interference between the conditional hiding logic and the form validation. Please Help!..
2 Replies
Cyber King
Cyber King8mo ago
No description
Cyber King
Cyber King8mo ago
No description