Skip to main content

Manage Properties and Apartments

Premium
6 min read

The Full Lesson is Only for Premium Members

Want to access all of our courses? (36 h 00 min)

You also get:

60 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Ali Al Qahtani avatar

In app/Filament/Resources/ApartmentResource.php:

there is mistake one line => RelationManagers\PropertiesRelationManager::class,

should be => RelationManagers\PropertyRelationManager::class,

Povilas Korop avatar

Thank you, dear Editor of our team :) Fixed now!

🥳 1
Alexey avatar

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.

Povilas Korop avatar

I think it worked well for me: first create a property, then apartments inside of it. What error are you getting when creating a property?

Alexey avatar

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? :)

Povilas Korop avatar

Oh now I understood the problem. according to the logic of the application, admins don't create apartments and properties, users do that via api, admins only edit them via filament adminpanel.

It would not be logical if admins added properties for someone.

Alexey avatar

Yes, that's right, agree with you. Thanx

gosocialdev avatar

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!

Modestas avatar

Hi, thanks for the kind words and a suggestion. We will take a look if that makes sense as an edit here or maybe a separate article as a warning

Davery avatar

Sadly hasCombinedRelationManagerTabsWithForm is no longer an option in Filament v3.

Dmytro Sakharuk avatar

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([
//..
]),

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.