Modal::getModalIdString()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
c 0
b 0
f 0
nc 2
nop 0
dl 0
loc 7
rs 10
1
<?php
2
3
namespace App\View\Components;
4
5
use Illuminate\View\Component;
6
7
class Modal extends Component
8
{
9
    public $title = '';
10
    public $id = '';
11
    /**
12
     * Create a new component instance.
13
     *
14
     * @return void
15
     */
16
    public function __construct($title, $id = '')
17
    {
18
        $this->title = $title;
19
        $this->id = $id;
20
    }
21
22
    /**
23
     * Get the view / contents that represent the component.
24
     *
25
     * @return \Illuminate\Contracts\View\View|\Closure|string
26
     */
27
    public function render()
28
    {
29
        return view('components.modal');
30
    }
31
32
    public function getModalIdString(): string
33
    {
34
        if ($this->id != '') {
35
            return $this->id;
36
        }
37
38
        return "model" . rand(1111, 9999);
39
    }
40
}
41