How to prevent access on New Company button when some subscription planned is expired?
Required disabled button not hide it. And use view that page, too.
7 Replies
You should solve this via Company Policy
@Dennis Koch Can you please share any referrece for the same, So I can understand.
Thanks!
The Filament docs indicate that Panels use Laravel Policies:
https://filamentphp.com/docs/3.x/panels/resources/viewing-records#authorization
The Laravel docs explain how to make Policies:
https://laravel.com/docs/10.x/authorization#creating-policies
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
@Dennis Koch I have checked said reference and made a policy of company but it hide the button New Company . we want application in view mode user can able to see create form and when he will click on Create button then a pop up is open and tell that your subscription is expired you will not able to create company.
Thanks ,
I didn’t understand the initial question. I thought it’s about hiding the button. You need to adjust the CreateAction then. I’d probably create 2 actions, one normal form action and one with a modal and hide the other depending on the subscription status.
@Dennis Koch yes i want to controller action . is it possible by middleware as like in normal laravel ? please see below example and guide me for the same .can I able to apply here as well .if yes then please guide me for the .If no then what should i do ?.
I already told you how I would solve it in my last answer. Something like this