Issues (9)

src/Managers/FieldSettingsManager.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Glorand\Model\Settings\Managers;
4
5
use Glorand\Model\Settings\Contracts\SettingsManagerContract;
6
7
/**
8
 * Class FieldSettingsManager
9
 * @package Glorand\Model\Settings\Managers
10
 * @property \Illuminate\Database\Eloquent\Model|\Glorand\Model\Settings\Traits\HasSettingsField $model
11
 */
12
class FieldSettingsManager extends AbstractSettingsManager
13
{
14
    /**
15
     * @param  array  $settings
16
     * @return \Glorand\Model\Settings\Contracts\SettingsManagerContract
17
     */
18 87
    public function apply(array $settings = []): SettingsManagerContract
19
    {
20 87
        $this->validate($settings);
21 87
22 87
        $this->model->{$this->model->getSettingsFieldName()} = json_encode($settings);
23
        if ($this->model->isPersistSettings()) {
24
            $this->model->save();
0 ignored issues
show
The method save() does not exist on Glorand\Model\Settings\Traits\HasSettingsField. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
            $this->model->/** @scrutinizer ignore-call */ 
25
                          save();
Loading history...
25 87
        }
26
27
        return $this;
28
    }
29
}
30