Dynamic Setting

Set dynamic setting (globally to a specific model) of your application

Table name: dynamic_settings

Description: enabling you to store & use settings dynamically, super flexible to change data

To learn more about how to use Dynamic Setting, check this out:

[Use dynamic settings]

Model

use SaasReady\Models\DynamicSetting;

Response Entity

type DynamicSetting = {
    uuid: string;
    settings: Record<string, string>; // key-value object
}

Endpoints

[GET] saas/dynamic-settings

Get a list of Dynamic Settings

Request payload:

{
    limit: int;
    page: int; 
    source_type?: string; // optional: the model class that you want to filter eg: App\Models\User
}

Response payload:

{
    data: DynamicSetting[],
}

[GET] saas/dynamic-settings/{dynamicSettingUuid}

Get a single Dynamic Setting

Response payload:

{
    data: DynamicSetting,
}

[POST] saas/dynamic-settings

Create a new Dynamic Setting for a Model

Request payload:

{
    source_id: int;
    source_type: string;
    settings: Record<string, any>;
}

Response payload:

{
    uuid: string,
}

[PUT] saas/dynamic-settings/{dynamicSettingUuid}

Update an existing Dynamic Setting

Request payload:

{
    settings: Record<string, any>;
    
    // only pass these 2 if you
    // want to change the source model
    source_id?: int;
    source_type?: string;
}

Response payload:

{
    uuid: string,
}

[DELETE] saas/dynamic-settings/{dynamicSettingUuid}

Delete an existing Dynamic Setting (soft)

Response payload:

{}

Last updated