laravel-enso / enso

Laravel Vue SPA, Bulma themed. For demo login use `admin@laravel-enso.com` & `password` -
https://www.laravel-enso.com
MIT License
1.08k stars 277 forks source link

New State logic - customization flexibility #393

Closed robbykrlos closed 3 years ago

robbykrlos commented 3 years ago

This is a feature request.

Prerequisites

Description

Hi,

Regarding the new state logic, that dynamically loads states from your vendor modules:

We had some small changes inside the older AppState.php, which now is spread in all State.php classes.

Can we have more flexibility on class bindings? (replacing new $provider with App::make($provider))

vendor/laravel-enso/core/src/Services/State/Builder.php

private function state(Source $source): Collection
{
    return $source->providers()
        ->map(fn ($provider) => App::make($provider))
        ->map(fn ($provider) => [
            'mutation' => $provider->mutation(),
            'state' => $provider->state(),
        ]);
} 

Or is there another way of doing this? (I saw that there is a configuration enso.state,vendor that may offer some flexibility, but does not make things easier).

I can PR the App::make($provider) myself it you're ok with it.

aocneanu commented 3 years ago

Sure, make a PR.

Also, if the changes you're talking about could benefit Enso, we could adopt those as well.

robbykrlos commented 3 years ago

Hi @aocneanu,

PR done. PR: New State logic - customization flexibility #393 #188

As for the changes mentioned, the small changes in ex-appState are related to a bigger change in the permission logic, that adds a new layer that is grouping multiple roles. You have at the moment Users-> Roles-> Permissions. We made a User-> Groups-> Roles-> Permissions, which I believe is too much for a change to be adopted and not sure it's really a benefit for Enso. It's still giving us some headaches when applying :) #185

aocneanu commented 3 years ago

PR was merged a while ago.