forked from ProcessMaker/processmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcessTemplates.php
More file actions
53 lines (44 loc) · 1.23 KB
/
ProcessTemplates.php
File metadata and controls
53 lines (44 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace ProcessMaker\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use ProcessMaker\Models\Process;
use ProcessMaker\Models\ProcessCategory;
use ProcessMaker\Models\Template;
use ProcessMaker\Traits\HasCategories;
use ProcessMaker\Traits\ProcessTrait;
class ProcessTemplates extends Template
{
use HasFactory;
use HasCategories;
use ProcessTrait;
protected $table = 'process_templates';
const categoryClass = ProcessCategory::class;
public $process_category_id;
/**
* Category of the process.
*
* @return BelongsTo
*/
public function category()
{
return $this->belongsTo(ProcessCategory::class, 'process_category_id')->withDefault();
}
/**
* Set multiple|single categories to the process
*
* @param string $value
*/
public function setProcessCategoryIdAttribute($value)
{
return $this->setMultipleCategories($value, 'process_category_id');
}
/**
* Get multiple|single categories of the process
*
* @param string $value
*/
public function getProcessCategoryIdAttribute($value)
{
return implode(',', $this->categories()->pluck('category_id')->toArray()) ?: $value;
}
}