Laravel Roles/Permissions: Complex Multi-Clinic Project

Поділитися
Вставка
  • Опубліковано 18 січ 2025

КОМЕНТАРІ • 38

  • @sandip7794
    @sandip7794 3 місяці тому +7

    I was struggling with how to handle roles and permissions in my CRM project, but I came across your UA-cam tutorial, and it was exactly what I needed. Thanks for sharing your knowledge-it's going to be a huge help!

  • @hassamulhaq7762
    @hassamulhaq7762 3 місяці тому +3

    it seems i also followed the best practices, such videos makes me confident.

  • @adammenczykowski
    @adammenczykowski 3 місяці тому +1

    Great summary Povilas! I like this sort of approach. I have done very similar myself before for a charity web app

  • @martinladipo2046
    @martinladipo2046 3 місяці тому +1

    Soooo timely!!!! This is one of my major concerns in the new project I'm working on cause i last watched a similar tutorial on this far back as 2019.... But I forgot how to implement it.

  • @SilindokuhleMapiyeye
    @SilindokuhleMapiyeye 3 місяці тому +1

    Thanks a lot! I started a project a few months ago, and I'm on the right track, but I need to fix the global scope on my models. All thanks to your help

  • @ibrahimabuhassanein6122
    @ibrahimabuhassanein6122 29 днів тому

    Grunt, Bower, Yeoman... Keep going ❤

  • @ilyasmohetna3648
    @ilyasmohetna3648 3 місяці тому +1

    Hello! Thanks for all the effort you put into these videos, I really appreciate it. I wanted to ask if you could show how to create a more complex, scalable project in Laravel, beyond the usual CRUD apps. For example, it would be great to see something that includes SSO with Keycloak or Laravel Socialite and Passport for authentication. Also, using services or actions instead of controllers would be amazing. What I’m hoping for is a project that combines all the best practices you know into one high-level project.

    • @LaravelDaily
      @LaravelDaily  3 місяці тому +2

      I don't imagine "all the best practices" in one project, as every project is individual.
      Using services/actions instead of controllers are shown MULTIPLE times on my channel, just search for services/actions.
      With SSO/Keycloak/Passport, it's a separate BIG topic in itself, with also multiple ways/tools to implement it. But actually needed for a very small part of developers. So, for now, I'm postponing such videos. But will try to come up with something more complex.

    • @rolomtech
      @rolomtech 3 місяці тому

      ​@@LaravelDailythanks for all you do sir, much love from Nigeria

  • @ryiad2010
    @ryiad2010 3 місяці тому

    the video is very helpful thanks Master

  • @davidsonzed
    @davidsonzed 2 місяці тому

    Hello Sir, can you please tell me one simple thing, is livewire a truly SPA style? can it be as fast as Inertia/vuejs? I will love to hear your opinion.

    • @LaravelDaily
      @LaravelDaily  2 місяці тому +1

      Define "truly". It's "SPA style" - yes.
      But it works differently by sending requests to the SERVER which, in some people's opinions, disqualifies it from SPA, by definition. But it actually depends on what is your project, its goals, and components on the page.

    • @davidsonzed
      @davidsonzed 2 місяці тому

      @@LaravelDaily THANK YOU

  • @andreashesse1653
    @andreashesse1653 2 місяці тому +2

    The RILT stack is just the best of both worlds! And inertia 2 has no breaking changes 🫠 almost too good to be true. Thanks for your always hi-q videos 🙌

  • @WellnessAndFitnessHub
    @WellnessAndFitnessHub 3 місяці тому

    Will this work in multi-database tenancy?
    Where do I place the roles and permissions tables in multi-database scenario, is it within the landlord or tenant database?

    • @LaravelDaily
      @LaravelDaily  3 місяці тому +1

      No, that's for single database. Can't answer about multiple databases, need to create a separate project and try it out

  • @CodeWithJagadish
    @CodeWithJagadish 3 місяці тому

    Where can I find this project? I need to check out the models and migrations.

    • @LaravelDaily
      @LaravelDaily  3 місяці тому

      The repository is in the premium course: laraveldaily.com/course/roles-permissions

    • @CodeWithJagadish
      @CodeWithJagadish 3 місяці тому

      ​@@LaravelDaily If team_id is nullable in the roles table, how should the team_id in the model_has_roles table handle null values? Is the nullable() missing on it? I mean, should a user still have roles even if they are not part of any teams? If that's not the case, then what's the purpose of having team_id as nullable in the roles table?

  • @juliaof.kataleko7595
    @juliaof.kataleko7595 3 місяці тому +1

    Hello!
    Will you continue with this projet?? (Complex multi clinic)

    • @LaravelDaily
      @LaravelDaily  3 місяці тому

      I don't have any more plans here, I just wanted to show roles/permissions/teams. What other features you're suggesting that would be useful to others?

    • @juliaof.kataleko7595
      @juliaof.kataleko7595 3 місяці тому

      @@LaravelDaily I imagined you would finish the clinic system.

  • @martinsinansky2817
    @martinsinansky2817 3 місяці тому +1

    Wouldn't checking the team be cleaner if it was done in middleware that would be applied to all related routes? With global scope I expect you would need to define it for every single model. If you manage a clinic and you have models like patients, health records, prescriptions and such, that would make quite a lot of repetition. Or am I missing something?

    • @LaravelDaily
      @LaravelDaily  3 місяці тому

      Good point. Both can work, in my opinion, global scope in each Model feels pretty clear to me, not sure how the same/similar code in Middlewares would look less repetitive. I guess a head-to-head comparison would be an interesting topic for a future video.

    • @martinsinansky2817
      @martinsinansky2817 3 місяці тому +1

      @@LaravelDaily I am not used to scopes yet, but , I only assume here, a simple check you added to the gate might be enough in the middleware. I expect with multiple models you could provide a trait like BelongsToTeam... Hmm, as I am thinking about it right now, I am getting what you mean. Might need an extra step in model inheritance to be able to check it for all models in a single method...

    • @LaravelDaily
      @LaravelDaily  3 місяці тому

      Yeah, that's an interesting point of "I am not used to scopes yet": it's a good example of developers using what they are more comfortable with. Which is perfectly fine! Laravel allows multiple ways to implement the same thing, in many places.

    • @krekas
      @krekas 3 місяці тому

      if you had multiple models you would create a trait or a global observer and would use on every model

  • @TotallyNotZoid
    @TotallyNotZoid 3 місяці тому

    Hey, love your videos man!
    I would love if you can make a video about FrankenPhp, how to actually write a caddyfile with frankenphp and create your app for production.
    I have setup my Laravel development with Sail but cannot figure out how to use Frankenphp and apply all the migrations, run workers and so on and go to production.

    • @LaravelDaily
      @LaravelDaily  3 місяці тому

      I haven't used Frankenphp myself, so can't make a video about it, sorry.

  • @IlPandax
    @IlPandax 3 місяці тому

    Great video! Is it ok to name enums without the word "enum" in it? I mean, when I write controllers I name them like "ExampleController" or when I write actions their name would be "ExampleAction". So "Permission" should be "PermissionEnum" and "Role" should be "RoleEnum". No?

    • @LaravelDaily
      @LaravelDaily  3 місяці тому +1

      It's a personal preference, but yes, now I regret NOT using that suffix here. In this project specifically, I even had a problem of app/Enums/Role conflicting with Role Model from Spatie package, so I needed to make alias like "use App\Enums\Role as RoleEnum".

    • @martinsinansky2817
      @martinsinansky2817 3 місяці тому

      It is totally OK, we use enums in multiple projects without naming them as SomethingSomethingEnum. Symfony and Laravel do some magic in the background with some classes like FormRequest, Action, Controller and such, that's why it is better to suffix the classes. It is not a requirement but the suffixes are helpful in navigating the code.

    • @IlPandax
      @IlPandax 3 місяці тому

      ​@@martinsinansky2817 I don't think this is correct. Controllers extend "app/Http/Controllers/Controller", that has traits and extends "BaseController", so this is the "magic" you a talking about. There is no "magic" related to names. So you could name your controller as you want, but we all agree that it's wrong.
      About enums, you can name them without suffix but, as Mr. Povilas said, you could have issues with other classes that could have similar names (my first thought would be Models names).
      So you can, but I don't think you should, IMHO. ;)

    • @IlPandax
      @IlPandax 3 місяці тому

      @@LaravelDaily Thanks! 👍

  • @DanielŚmigiela
    @DanielŚmigiela 3 місяці тому

    Graet!

  • @BelgranoK
    @BelgranoK 3 місяці тому +2

    I think that in tua-cam.com/video/Fe0VSwpZpaU/v-deo.html you may use 'match' that is more convinient than 'switch'

    • @LaravelDaily
      @LaravelDaily  3 місяці тому +1

      Yes, good point, it's a personal preference.