Voyager RU
  • Вступление
  • С чего начать
    • Что такое Voyager
    • Требования
    • Установка
    • Upgrading
    • Конфигурации
  • BREAD
    • Введение
    • Отношения
    • Поля форм
      • Флажки (Checkbox)
      • Координаты
      • Дата и время
      • Выпадающий список (Dropdown)
      • Изображения
      • Загрузка файлов (Media Picker)
      • Ввод чисел (Number)
      • TinyMCE
  • Основные концепции
    • Маршрутизация
    • Медиа-менеджер
    • Меню и конструктор меню
    • Управление базой данных
    • Настройки
    • Навигатор (Compass)
    • Роли и разрешения
    • Helper methods
    • Многоязычность
  • Персонализация
    • Переопределение файлов
    • Переопределение маршрутов
    • Additional CSS and JS
    • Enabling Soft-Delete
    • Custom relationship attributes
    • Adding custom Formfields
    • Coordinates
    • BREAD accessors
    • custom-guard
    • Action buttons
  • troubleshooting
    • Using HTTPS on yours site
    • Missing required parameter
Powered by GitBook
On this page
  • Table Configurations in Voyager
  • Editing the Table's Model

Was this helpful?

  1. Персонализация

Enabling Soft-Delete

PreviousAdditional CSS and JSNextCustom relationship attributes

Last updated 4 years ago

Was this helpful?

This is only to assist with enabling soft-deletion for your models within Voyager. Please refer to the for specifics.

Table Configurations in Voyager

When creating a table using the Database Manager you've selected the 'Add Soft Deletes' button and then when adding the BREAD functionality to that table you've added a Model Name, you only have to edit your Model file to fully enable Soft-Delete on that table.

Editing the Table's Model

A default model will look like this:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;


class YourModelName extends Model
{

}

Just turn it into:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;


class Documento extends Model
{
    use SoftDeletes;
    protected $dates = ['deleted_at'];
}

And from now on, every time you delete a record from that table, it won't actually be deleted, only the deleted_at column will be written with the current timestamp.

Laravel documentation