limosa-io / laravel-scim-server

SCIM 2.0 Server implementation for Laravel
MIT License
47 stars 28 forks source link

Add support for model factories #49

Closed besanek closed 11 months ago

besanek commented 12 months 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 11 months ago

Thanks!