winter/modules/system/models/MailLayout.php

34 lines
753 B
PHP
Raw Normal View History

<?php namespace System\Models;
use Model;
2015-01-28 18:03:35 +11:00
use ApplicationException;
2014-10-03 18:00:21 +10:00
/**
* Mail layout
*
* @package october\system
* @author Alexey Bobkov, Samuel Georges
*/
class MailLayout extends Model
{
use \October\Rain\Database\Traits\Validation;
/**
* @var string The database table used by the model.
*/
protected $table = 'system_mail_layouts';
public $rules = [
'code' => 'required|unique:system_mail_layouts',
'name' => 'required',
'content_html' => 'required',
];
public function beforeDelete()
{
2014-10-18 11:58:50 +02:00
if ($this->is_locked) {
throw new ApplicationException('Cannot delete this template because it is locked');
2014-10-18 11:58:50 +02:00
}
}
2014-10-18 11:58:50 +02:00
}