# LayoutRows

## Introduction

`LayoutRows` represent a row in a user defined [Layout](/api-reference/layouts/layouts.md). `LayoutRows` can consist of many [LayoutColumns](/api-reference/layouts/layout-columns.md) and are always attached to a [Layout](/api-reference/layouts/layouts.md). There can not be any Element in a `LayoutRow` without being attached to a [LayoutColumn](/api-reference/layouts/layout-columns.md).

## Model Definition

### Alias

`layoutRow`

### Relations

| Key             | Relation                                                  | Type       | Relation Field(s)            |
| --------------- | --------------------------------------------------------- | ---------- | ---------------------------- |
| `layout`        | [Layout](/api-reference/layouts/layouts.md)               | Belongs to | `layout_id`                  |
| `layoutColumns` | [LayoutColumns](/api-reference/layouts/layout-columns.md) | Has many   | `layoutColumn.layout_row_id` |

### Traits

* `Sortable`
* `SoftDeletes`

## List

Get a list of all `LayoutRows` available in the system.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/layouts/rows`

**Example Request**

{% tabs %}
{% tab title="PHP" %}

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

{% endtab %}
{% endtabs %}

**Example Response**

```json
[
  {
    "id": 2,
    "title": null,
    "layout_id": 1,
    "separator": false,
    "sort_number": 3,
    "created_at": "2021-10-25 19:07:59",
    "updated_at": "2021-10-25 19:07:59",
    "deleted_at": null
  },
  {
    "id": 3,
    "title": null,
    "layout_id": 2,
    "separator": false,
    "sort_number": 1,
    "created_at": "2021-10-26 15:00:21",
    "updated_at": "2021-10-26 15:00:21",
    "deleted_at": null
  },
  {
    "id": 4,
    "title": null,
    "layout_id": 2,
    "separator": false,
    "sort_number": 3,
    "created_at": "2021-10-26 15:00:21",
    "updated_at": "2021-10-26 15:00:21",
    "deleted_at": null
  }
]
```

## Show

Show a single `LayoutRow` by `id`.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/layouts/rows/{id}`

**Example Request**

{% tabs %}
{% tab title="PHP" %}

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

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "id": 2,
  "title": null,
  "layout_id": 1,
  "separator": false,
  "sort_number": 3,
  "created_at": "2021-10-25 19:07:59",
  "updated_at": "2021-10-25 19:07:59",
  "deleted_at": null
}
```

## Create

Creates a new `LayoutRow`

**Definition**

<mark style="color:yellow;">`POST`</mark> `/api/layouts/rows`

**Request Keys**

| Key           | Type    | Default            | Description                                           |
| ------------- | ------- | ------------------ | ----------------------------------------------------- |
| `title`       | string  | `null`             | The title for the `LayoutRow`.                        |
| `layout_id`\* | integer | -                  | The `Layout` this `LayoutRow` belongs to.             |
| `separator`   | boolean | `false`            | Whether there should be a separator displayed or not. |
| `sort_number` | integer | Current highest +1 | The index of the `LayoutRow` related to the `Layout`. |

Keys with `*` are required.

***

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/layouts/rows', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'title' => null,
        'layout_id' => '1',
        'separator' => 'false',
        'sort_number' => '1',
    ]
]);

```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "status": "success",
  "data": {
    "id": 1,
    "title": null,
    "layout_id": 1,
    "separator": false,
    "sort_number": 1,
    "created_at": "2023-04-28 13:55:21",
    "updated_at": "2023-04-28 13:55:21",
    "deleted_at": null
  }
}
```

## Update

Update an existing `LayoutRow` by `id`.

**Definition**

<mark style="color:blue;">`PUT`</mark> `/api/layouts/rows/{id}`

**Request Keys**

| Key           | Type    | Default | Description                                           |
| ------------- | ------- | ------- | ----------------------------------------------------- |
| `title`       | string  | -       | The title for the `LayoutRow`.                        |
| `layout_id`   | integer | -       | The `Layout` this `LayoutRow` belongs to.             |
| `separator`   | boolean | -       | Whether there should be a separator displayed or not. |
| `sort_number` | integer | -       | The index of the `LayoutRow` related to the `Layout`. |

Keys with `*` are required.

**Example Request**

{% tabs %}
{% tab title="PHP" %}

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

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "status": "success",
  "data": {
    "id": 1,
    "title": null,
    "layout_id": 1,
    "separator": true,
    "sort_number": 1,
    "created_at": "2023-04-28 13:55:21",
    "updated_at": "2023-04-28 13:57:40",
    "deleted_at": null
  }
}
```

## Delete

Delete an existing `Layout` by `id`.

**Definition**

<mark style="color:red;">`DELETE`</mark> `/api/layouts/rows/{id}`

**Example Request**

{% tabs %}
{% tab title="PHP" %}

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

{% endtab %}
{% endtabs %}

**Example Response**

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.api.intratool.de/api-reference/layouts/layout-rows.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
