Theme::disableOtherThemes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace App\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class Theme extends Model
8
{
9
    public function updateColors($array)
10
    {
11
        $this->background = $array['background'] ?? 'white';
12
        $this->container_background = $array['container_background'] ?? 'grey';
13
        $this->title = $array['title'] ?? 'black';
14
        $this->text = $array['text'] ?? 'black';
15
16
        $this->menu_item_text = $array['menu_item_text'] ?? 'white';
17
        $this->menu_item_background = $array['menu_item_background'] ?? 'black';
18
        $this->menu_item_active_text = $array['menu_item_active_text'] ?? 'black';
19
        $this->menu_item_active_background = $array['menu_item_active_background'] ?? 'white';
20
21
        $this->categories_list_text = $array['categories_list_text'] ?? 'white';
22
        $this->categories_list_background = $array['categories_list_background'] ?? 'black';
23
24
        $this->tags_list_text = $array['tags_list_text'] ?? 'white';
25
        $this->tags_list_background = $array['tags_list_background'] ?? 'black';
26
    }
27
28
    public function disableOtherThemes()
29
    {
30
        \DB::table('themes')->where('id', '!=', $this->id)->update(['selected' => false]);
31
    }
32
}
33