Skip to content

Instantly share code, notes, and snippets.

@iboved
Created March 15, 2018 16:25
Show Gist options
  • Save iboved/8d90fe4aae6a67fc37f859c881ba3e00 to your computer and use it in GitHub Desktop.
Save iboved/8d90fe4aae6a67fc37f859c881ba3e00 to your computer and use it in GitHub Desktop.
# ===================================
# Form Field Definitions
# ===================================
fields:
title:
label: Title
span: left
type: text
sluggable:
label: Slug
type: sluggable
relationName: slugs
preset:
field: title
type: slug
span: right
required: true
<?php namespace Acme\Demo\Models;
use Model;
use BusyRoomsCMS\Backend\Traits\BaseTrait;
/**
* Post Model
*/
class Post extends Model
{
use BaseTrait;
public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel'];
public $translatable = [
'title',
];
/**
* @var array Guarded fields
*/
protected $guarded = ['*'];
/**
* @var array Fillable fields
*/
protected $fillable = [];
public $morphMany = [
'slugs' => ['BusyRoomsCMS\Backend\Models\Slug', 'name' => 'sluggable', 'delete' => true],
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment