limosa-io / laravel-scim-server

SCIM 2.0 Server implementation for Laravel
MIT License
51 stars 29 forks source link

Add support for model factories #49

Closed besanek closed 1 year ago

besanek commented 1 year ago

This pull request introduce Callback Factory for Models. This is needed where we need to add attributes to the model via SCIM that are not sent by the client.

For example, if I want to add the id of the user who added the user, I can add this factory to the config.

//SCIMConfig
            'query' => null,
            'factory' => function () {
                $user = new User();
                $user->created_by = Auth::id();
                return $user;
            },
            'validations' => [
arietimmerman commented 1 year ago

Thanks!