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