ahloudev
How to retain sidebar scroll position if there are many menu items.
Add this inside AppserviceProvider class at boot() method
FilamentView::registerRenderHook(
'panels::body.end',
fn (): View => view('additional-scripts'),
);
And inside resources/views/additional-scripts.blade.php file, add this
<script>
const sidebarNav = document.querySelector('.fi-sidebar-nav');
const SCROLL_POSITION_KEY = 'SIDEBAR_SCROLL_TOP';
window.addEventListener('DOMContentLoaded', () => {
sidebarNav.scrollBy(0, Number(window.localStorage.getItem(SCROLL_POSITION_KEY) || 0))
Array.from(document.querySelectorAll('.fi-sidebar-item-button')).forEach(sidebarItem => {
sidebarItem.addEventListener('click', e => {
const scrollTop = sidebarNav.scrollTop;
window.localStorage.setItem(SCROLL_POSITION_KEY, scrollTop);
});
});
});
</script>
3 replies
How to manage users in multi tenant app
i generated UserResource inside my multi tenant app
but i got exception that says i should have school_year_id in my users table
since SchoolYear is a tenant model in this context
So i added that column to the users table and also added schoolYear(): belongsTo relationship to User model and that fixed the issue but i'm not sure that's the right way to implement user management inside multi tenant application
So i added that column to the users table and also added schoolYear(): belongsTo relationship to User model and that fixed the issue but i'm not sure that's the right way to implement user management inside multi tenant application
6 replies