Layouts

Introduction

Layouts describe user defined display information for many different entities. Especially used on Form components Layouts are the main component for relating display information to different types.

Layouts usually consist of at least one LayoutRow and LayoutColumn. Elements are attached to LayoutColumns utilizing LayoutColumnLayoutElements.

Model Definition

Alias

layout

Relations

Key
Relation
Type
Relation Field(s)

layoutable

Morph to

layoutable_type, layoutable_id

layoutRows

Has many

layoutRows.layout_id

Layoutable types

Layoutable types are keys for different entities existing in our system. Every layoutable type listed here has itself a relationship to Layouts which can be accessed with the key layout.

Affected entities are marked with the trait Layoutable.

Types

Currently only the default type is supported.

Traits

  • Sortable

  • SoftDeletes

List

Get a list of all Layouts available in the system.

Definition

GET /api/layouts

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/layouts', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

[
  {
    "id": 1,
    "title": null,
    "layoutable_type": "form",
    "layoutable_id": 2,
    "type": "default",
    "sort_number": 1,
    "created_at": "2021-10-26 15:00:20",
    "updated_at": "2021-10-26 15:00:20",
    "deleted_at": null
  },
  {
    "id": 2,
    "title": null,
    "layoutable_type": "form",
    "layoutable_id": 6,
    "type": "default",
    "sort_number": 1,
    "created_at": "2022-05-01 15:16:01",
    "updated_at": "2022-05-01 15:16:01",
    "deleted_at": null
  }
]

Show

Show a single Layout by id.

Definition

GET /api/layouts/{id}

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/layouts/1', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
]);

Example Response

{
  "id": 1,
  "title": null,
  "layoutable_type": "form",
  "layoutable_id": 2,
  "type": "default",
  "sort_number": 1,
  "created_at": "2021-10-26 15:00:20",
  "updated_at": "2021-10-26 15:00:20",
  "deleted_at": null
}

Create

Creates a new Layout

Definition

POST /api/layouts/

Request Keys

Key
Type
Default
Description

title

string

null

The title for the layout.

layoutable_type*

string

-

Layoutable type (see above).

layoutable_id*

string

-

Layoutable ID (see above).

type*

required

'default'

The type of the layout (see above).

sort_number

required

Current highest +1

The index of the Layout related to the Layoutable.

Keys with * are required.

Advanced Key-Specifications

  • type - The given type must be unique for the targeted Layoutable


Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/layouts/', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        "title": null,
        'layoutable_type' => 'form',
        'layoutable_id' => '24',
        'type' => 'default',
        'sort_number' => '1',
    ]
]);

Example Response

{
  "status": "success",
  "data": {
    "id": 16,
    "title": null,
    "layoutable_type": "form",
    "layoutable_id": 24,
    "type": "default",
    "sort_number": 1,
    "created_at": "2023-04-28 13:44:46",
    "updated_at": "2023-04-28 13:44:46",
    "deleted_at": null
  }
}

Update

Update an existing Layout by id.

Definition

PUT /api/layouts/{id}

Request Keys

Key
Type
Default
Description

title

string

-

The title for the layout.

layoutable_type

string

-

Layoutable type (see above).

layoutable_id

string

-

Layoutable ID (see above).

type

required

-

The type of the layout (see above).

sort_number

required

Current highest +1

The index of the Layout related to the Layoutable.

Advanced Key-Specifications

  • type - A given type must be unique for the targeted Layoutable

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('PUT', '/api/layouts/1', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'title' => null,
        'layoutable_type' => 'form',
        'layoutable_id' => '24',
        'type' => 'default'
        'sort_number' => 2
    ]
]);

Example Response

{
  "status": "success",
  "data": {
    "id": 16,
    "title": null,
    "layoutable_type": "form",
    "layoutable_id": 24,
    "type": "default",
    "sort_number": 2,
    "created_at": "2023-04-28 13:44:46",
    "updated_at": "2023-04-28 13:45:28",
    "deleted_at": null
  }
}

Delete

Delete an existing Layout by id.

Definition

DELETE /api/layouts/{id}

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('DELETE', '/api/layouts/1', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

{
  "status": "success",
  "data": null
}

Last updated