oliverbusk's avatar

Rent frequency

Hi there

I am building a small system to manage my rental units. I have a few units that I lease to different tenants. A rental unit can have different payment schedules - for example:

  • Once every month (on the 1st)
  • Once every month (on the XX day)
  • Once every quarter
  • Once per year

Currently, my setup looks like this and can only handle the first case (once every month on the first):

 Schema::create('leases', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('rent_frequency')->default('monthly');
            $table->timestamps();
});

My first thought was to just set the rent_frequency to e.g. "yearly" or "quarterly", and then perhaps just parse it with Carbon\Carbon, but I am not sure if that is a good way.

Can anyone help me on how I can make the payment scheduling more flexible, to allow for the above scenarios?

0 likes
9 replies
martinbean's avatar

@oliverbusk I think the simplest solution would be to have three columns: rent_frequency, rent_frequency_count, and anchor_date (this naming is borrowed heavily from Stripe’s for subscriptions).

You would use the rent_frequency and rent_frequency_count columns to determine how often to collect payments. So a rent_frequency of “month” and rent_frequency_count of “3” would represent every three months (quarterly).

The anchor_date column would then hold the date to start billing from. So if you had an anchor_date of “2021-03-11”, then your cycle would be “every three months from March 11, 2021” meaning the next payment would be due on June 11, 2021; the payment after that on September 11; 2021; and so on.

1 like
oliverbusk's avatar

That's an interesting approach. How would this work with code though?

For example, if I want to set up a payment schedule for the 15th for every month:

id | name                    | rent_frequency | rent_frequency_count | anchor_date
1  | Highland Rd 15   | month                | 1                                       | 15.04.2021

What is the best way to actually get this information from the Lease model? With a accessor?

For example, I could imagine I would need to print out the payment schedule:

public function getPaymentDateAttribute($value)
{
     //....
}

Or just declare some methods on the model? If I need to get the next payment date:

public function NextPaymentDate()
{
     //....
}
oliverbusk's avatar

Also, @martinbean - what if the anchor date is set to e.g January 31, 2021 and the rent frequency is 1 time every month - how would that work for months where there are not 31 days?

Snapey's avatar

i would probably also store next payment date so that you can easily index rentals by coming up, due and overdue.

When they pay you can bump up the next payment date according to the terms

This also gives you a place to store the business logic for handling short months if that comes into play, eg rolling back to last day of the month

One thing to watch is not losing the payment anniversary date, eg after moving the february rent back from the 31st to the 28th you don't then charge march on the 28th also

If this were a platform just for myself, if might be tempted to say any rentals starting on 29,30 and 31 will start on the 1st and save myself worrying about the scenarios

oliverbusk's avatar

Very good point in regards to up, due and overdue payments - I would definetely need to be able to check for that.

I agree, that it might be easier to simply just move it to the 1st of the month, if the date is after the 28th. Thanks!

jlrdw's avatar

How are you running your reports to see when rent is due? Printing out? Just viewing on screen?

oliverbusk's avatar

I wanted to utilize some sort of admin package (E.g. Nova), to show a list of my rental units and when the rent was due. Once I collected the rent, I want to mark them individually as "Paid" (for that specific payment schedule - as rent is collected again on the next payment schedule, and thus the unit should show up again)

jlrdw's avatar

Well there could be a little more to it have you accounted for late payment and is there a charge for a late rental. Have you accounted for taxas and IRS if you are in the United States considerations.

Are there any times you are allowing partial payments only.

What if someone pays in advance is that allowed.

I would really consider sitting down with paper and pencil and drawing out some diagrams and exactly all the details of an application first.

Is utilities included or does the renter pay their own utilities that's another thing to consider.

I have written similar applications and there is a lot to consider.

Sometimes there are other fees to consider.

Another idea if there's any similar applications on GitHub, but if you want to write your own you could study the code and get some ideas.

As it's been a while since I have done such things and years ago that was in Java.

Please or to participate in this conversation.