FormContentPublish::make()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace Apps\Model\Admin\Content;
4
5
use Apps\ActiveRecord\Content;
6
use Ffcms\Core\Arch\Model;
7
use Illuminate\Database\Eloquent\Collection;
8
9
/**
10
 * Class FormContentPublish. Make content record public - set marker in active record object
11
 * @package Apps\Model\Admin\Content
12
 */
13
class FormContentPublish extends Model
14
{
15
    /** @var Content|Collection */
16
    private $_records;
17
18
    /**
19
     * FormContentPublish constructor. Pass records inside
20
     * @param Content[]|Collection $records
21
     */
22
    public function __construct($records)
23
    {
24
        $this->_records = $records;
25
        parent::__construct();
26
    }
27
28
    /**
29
     * Update records and set display = 1
30
     */
31
    public function make()
32
    {
33
        $this->_records->update(['display' => 1]);
34
    }
35
}
36