Comments & Discussion
Hi Povilas. There is a little problem that we can't create a new Property if we haven't any Apartments now. And we can't add an Apartment without Property. I think the main entity here is a Property but not an Apartment.
The problem is I can't get a Property add form if I haven't any Apartments. This is 2 examples what I say: https://disk.yandex.ru/i/OwP2oG3Omb2DDQ https://disk.yandex.ru/i/6rsX_IvwRp88fw How to create a Property in this case? :)
Hi Povilas, Nice course.
Just wanted to say that it's better to remove the "preload()" for Property dropdown from ApartmentResource.php (Edit Apartment) => Forms\Components\Select::make('property_id')
I used the Performance Seeds from related course and I have thousands of properties (99k) and didn't know why the Edit Apartments page was loading in 30 seconds. I noticed the preload(), it loads all 99k properties on that dropdown, so it's better to remove it. :)
Thank you for all courses and especially for 'Booking' ones!
PropertyRelationManager seems a bit confusing because in our system, an Apartment belongs to a Property rather than having a belongs to many relationship. I would directly include the action for creating a Property within the select.
Forms\Components\Select::make('property_id') ->preload() ->required() ->searchable() ->relationship('property', 'name') ->createOptionForm([ //.. ]),
In app/Filament/Resources/ApartmentResource.php:
there is mistake one line => RelationManagers\PropertiesRelationManager::class,
should be => RelationManagers\PropertyRelationManager::class,
Thank you, dear Editor of our team :) Fixed now!