lunar icon indicating copy to clipboard operation
lunar copied to clipboard

Refactor Staff model

Open adevade opened this issue 1 year ago • 4 comments

Note: This PR is easiest to review commit by commit. Feel free to pick and choose what you like and revert the ones you don't.

The reason for removing the Docblocks is because Filament barely uses any. With clear property/method names, type hints and return types they often feel superfluous.

I think that we can remove the custom route binding after this PR was merged in Livewire(?)

I usually use my accessors as the rest of my attributes (snake cased), but don't know if you have a strong preference? Both still works. Especially in $appends I think it should be snake cased, since otherwise it would be mixing case with the other fields from the DB.

Marking as draft for now, to let the tests run and get some feedback.

adevade avatar May 28 '24 14:05 adevade

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lunar-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 15, 2025 9:10am

vercel[bot] avatar May 28 '24 14:05 vercel[bot]

@adevade Sorry this one took a while, looks pretty okay to me. I've added a small test (which didn't exist before) lmk your thoughts and we can get this merged.

alecritson avatar Sep 13 '24 10:09 alecritson

@alecritson Nice work with the test! 👍

One thing I noticed is that firstname and lastname is defined without underscores. Should fullname be that as well, for consistency? Easier than migrating both first and last name columns I guess?

adevade avatar Sep 13 '24 10:09 adevade

@alecritson Nice work with the test! 👍

One thing I noticed is that firstname and lastname is defined without underscores. Should fullname be that as well, for consistency? Easier than migrating both first and last name columns I guess?

I think if anything we'd be better to migrate firstname to first_name it's something that's bothered us internally since elsewhere we use underscores. Not sure if it's something we need to worry about right now though @glennjacobs ?

alecritson avatar Sep 13 '24 10:09 alecritson

@alecritson Nice work with the test! 👍 One thing I noticed is that firstname and lastname is defined without underscores. Should fullname be that as well, for consistency? Easier than migrating both first and last name columns I guess?

I think if anything we'd be better to migrate firstname to first_name it's something that's bothered us internally since elsewhere we use underscores. Not sure if it's something we need to worry about right now though @glennjacobs ?

I guess if we don't do it now, then it may never get another look. So maybe we get it done in this PR?

glennjacobs avatar Nov 19 '24 23:11 glennjacobs

I've now updated the code base to use first_name and last_name.

Since users might be referencing $staff->firstname in their own code, I've added fallback accessor and mutators for both $firstname and $lastname on the Staff model.

I did not update the CLI argument keys on MakeLunarAdminCommand, since it feels better for them to not have underscores.

I have not yet touched any documentation.

adevade avatar Nov 25 '24 10:11 adevade

Hi @adevade I realise this is an old PR, apologies.

Is this something that still needs active work? Looks like there is a checklist of items in the readme?

alecritson avatar Apr 10 '25 12:04 alecritson

@alecritson Should still be good to merge 👍 The tests are passing. Haven't looked at it in a good while though...

adevade avatar Apr 10 '25 12:04 adevade