0

I'm currently in the planning phase / feasability study of a rather big web application which is meant to be implemented using Laravel. My own experience on the matter is rather limited but I'd like to take the opportunity to further my skills and, if successful, release the basis of the code under MIT license for anyone to use.

The task at hand (sorry for the essay but it's rather complex):

I'm working for a company with a rather complex customer and service structure: We offer multiple services, ranging from risk assessment to education (online and on-site) in workplace safety, security data sheets for products, environmental questions, data protection etc. and want to create a platform that allows us to manage our customer and service structure while also giving our customers access to these services online, including API support. Customers may have entirely different company hierarchies, ranging from a small company of 10 employees that just distinguishes between regular employees and management to companies with thousands of employees with complex hierarchies including multiple branches, departments, sites and project management.

Some of our services are specific to sites, some to departments, some to branches, some to projects (e.g. a construction project) and/or to the whole company. We wish to have different access levels for different employees of the customers and the optional ability for customer admins to manage their own users/permissions.

The idea was to create a global management platform which manages the whole customer, user and permission structure with the individual services being split up into different apps which are included in the global platform but can individually be assigned to each customer with the ability to assign certain roles for users and groups to each app, also users can have multiple group memberships and different roles in different groups. These apps not only include our services, but also basic functionality like user and group management. The management of the platform should be separate from the user part, meaning our employees should have access via an administrative dashboard while also having the ability to assign a certain customer to a certain employee of ours with the permission to manage one or more specific service for this customer.

Here is the idea for a database structure I had: Database structure The individual services/apps will have their own respective tables except for the ones which are there for global management functionality like user management.

The questions I have:

  1. Is this even feasible to do with Laravel? If not, what are the alternatives?
  2. Is my database structure ok or compeletely stupid for the task at hand?
  3. Which are the Laravel plugins I should look into?
  4. Any other directions, e.g. folder structure within the laravel project folder etc.?
  • Please avoid asking multiple questions in a single question. Question 1 is likely too broad itself (what does "feasible" mean to you?); 2) is most likely opinion-based; 3) Software and tool recommendations are off topic for this site; 4) is either too broad or opinion-based (or both). – Greg Burghardt Nov 13 '19 at 19:02
  • Sorry, but I have no idea how else to put it. I mean if I break it down into simpler single questions one might lose the general idea. Towards the others, I have no idea where and how to ask. – Broco Nov 13 '19 at 23:03
  • First mistake: focus on a technology/tool before having figured out your general approach. Also, questions 3 and 4 are offtopic on this site, questions 1 and 2 should be reworded (see Why "is it possible" poor wording). – marstato Nov 18 '19 at 10:19
  • Sorry, also: your question doesn't really get to a point. The text is very broad and unprecise, the database schema doesn't really speak for itself and is also under doubt because you're uncertain about it. As-is this cannot be answered productively IMO. – marstato Nov 18 '19 at 10:22
  • 1
    @Broco the SE approach is to have questions and answers that are helpful not only for the original poster. Your scenario is very specific, making it hard to fit for that approach. I suggest: put together an accurate description of the requirements for your access control system. You can post both that and your EER to codereview.SE. Take a look at the strengths and weaknesses of laravels active record ORM. Compare with unit-of-work ORMs (for PHP that's Doctrine, most likely). Look at the similarities between the out-of-the box access control different frameworks provide and your own model. – marstato Nov 18 '19 at 11:09
1
+50

First off, i'd like to clarify that i'm fairly new in Laravel myself and that there are far more experienced people in terms of Software Engineering. So please take my answer with a grain of salt. I am however working on a big application myself for the last 2 months using Laravel. I will also try to answer your question 'as is' which seems to be focused on Laravel.

Is this even feasible to do with Laravel? If not, what are the alternatives?

From your question i cannot see why this would not be possible using Laravel.

Is my database structure ok or compeletely stupid for the task at hand?

As it is right now, this is unclear to me. Make sure you can solve every possible problem with your DB structure. In the process of designing, you have to ask youself many tough questions.

  • What if people leave?
  • What if a company fuses / takes a on a completely different structure?
  • What if people get a completely different role? But have done important tasks for that organisation in the past?
  • Could i add things without getting into trouble?

And countless more.

Which are the Laravel plugins I should look into?

Well i can recommend a general direction.

Remember that Laravel already has done the bulk of the work for you. So when you have come up with a general solution, make sure you always check the docs. I cannot tell you how much time this saved me.

Any other directions, e.g. folder structure within the laravel project folder etc.?

Yes! You will most likely need versioning of some sort (especially within your API. ) This will save you alot of trouble when trying to expand your application. You can achieve this easily using Route groups and prefixing.

For example, create a Api route group using v1. Now every route within this group will begin with /api/v1/. Now when you have to change your api, you won't agitate everyone using your api.

While your application is growing and changing, make sure you take a closer look at Eloquent's resources. This will allow you to stay flexible, and not break your application when you have to make changes to your database.

Again, i know there is alot more to your question. But i tried to take a look at your post from the perspective of utilities offered by Laravel.

  • 1
    Thanks a lot! That actually gave me great directions. I'll check it out. – Broco Nov 19 '19 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.