Tables

Introduction

Data tables allow you to create structures for all the data you need while building your website, like products, brands, vacancies, team members... but also contact requests, subscriptions, and so on. You're completely free to create the tables and fields you need.

In the sidebar, you can organize tables in groups. You can drag & drop to rearrange groups and tables.

To create a table, right-click on a group in the sidebar and choose Create Table. You'll have to choose a unique name and slug for the new table.

Devisto creates 3 fields automatically for every new table: title, slug and published. If you don't need these fields, you're free to remove them.

Entries

The first thing you see when clicking a table, are the entries in the table. Click on an entry to edit it. A new panel will appear with all the fields of the table. The entry will be highlighted in the table so it's clear which entry you're editing.

Click Create Entry in the upper right corner to create a new entry. Right-click an entry to duplicate or delete it.

If there exists a dynamic page for this table, there is a unique URL for each entry. In this case you can right-click an entry and choose Open in Preview, Open in New Tab or Copy URL.

Before every entry in the table, there is a checkbox. This lets you check one or more entries and perform actions on all checked entries. You can use the Shift key to check a range of entries. When checking one or more entries, a panel will appear on the bottom of the screen, which will show how many entries are checked. Click Select All in the panel to select all entries in the table. When there is a boolean field called published in the table, the Publish and Unpublish actions will be available.

Columns

By clicking the Columns button, you can define which columns are visible in the entry table. Showing or hiding columns only has consequences for the entry table, not for the entries themselves. So a hidden column will still appear when creating or editing an entry.

Sorting

To sort the table by a certain field:

  • Click the column title
  • Click it again to reverse the sort order
  • Click it again to reset the order

Searching

In the search field, you can use a special syntax to find exactly what you're looking for. It's inspired by Gmail search. Once you get the hang of it, it gives you super powers.

Search Results
apple All entries with 'apple' in a text field (including text fields of related tables)
apple iphone All entries with 'apple' or 'iphone' in a text field (including text fields of related tables)
"apple iphone" All entries with exactly 'apple iphone' in a text field (including text fields of related tables)
name:iphone The name field must contain 'iphone'
name=iphone The name field must be exactly 'iphone'
name:"apple iphone" The name field must contain 'apple iphone'
name="apple iphone" The name field must be exactly 'apple iphone'
brand:apple Search a relation
brand.name:apple Search a field of a relation
created_at<2020 Less than
created_at<=2020 Less than or equal to
created_at>2020 Greater than or equal to
created_at>=2020 Greater than or equal to
published!=1 Not equal to

Title Field

The Title Field of a table defines a string representation of the entries:

  • When you create a relation in another table to this table, this field will be used to select and display the linked entries.
  • You can call ->title() on any entry to get this string representation, for use in breadcrumbs, navigations, and so on.

URL Field

The URL Field of a table defines which field is used to build the URL of the entries in this table. This will only be used when there exists a dynamic page for this table. Only slug fields and the ID field can be used as URL Field.

Accessing Data In Code

The slug is an important property of the table: it's a unique handle to access the table in code. Calling the table() helper gives you an Eloquent Query Builder for that table, which you can use to query whatever you want from it.

Let's say we have a table with the slug vacancies, then we can access the table as follows:

// Get a table by slug, returns a query builder
table('vacancies');

// Get all entries
table('vacancies')->get();

// Get the number of entries
table('vacancies')->count();

// All Laravel query builder features can be used
table('vacancies')->where('published', 1)->has('location')->lastest()->get();

You can use these things directly in your views, for example in a loop:

@foreach (table('vacancies')->where('published', 1)->has('location')->lastest()->get() as $vacancy)
    <h2>{{ $vacancy->title }}</h2>
@endforeach
Previous topic
← Redirects
Next topic
Fields →