Test Failed
Pull Request — main (#21)
by
unknown
07:08 queued 03:25
created

LabelServiceProvider::boot()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
eloc 8
c 3
b 0
f 1
dl 0
loc 15
rs 10
cc 2
nc 1
nop 0
1
<?php
2
3
namespace Hafijul233\Form\Providers;
4
5
use Hafijul233\Form\Facades\Form;
6
use Illuminate\Support\Facades\Config;
7
use Illuminate\Support\ServiceProvider;
8
9
/**
10
 * Class LabelServiceProvider
11
 */
12
class LabelServiceProvider extends ServiceProvider
13
{
14
    /**
15
     * Loading All Label Style
16
     */
17
    public function boot()
18
    {
19
        Form::macro('hLabel', function ($name, $value, $required = false, $options = []) {
20
            $col_size = Config::get('form.horizon_label_size', 2);
21
22
            if (isset($options['col_size'])) {
23
                $col_size = $options['col_size'];
24
                unset($options['col_size']);
25
            }
26
27
            return Form::label($name, $value, $required, array_merge(['class' => "col-md-{$col_size} col-form-label"], $options), false);
28
        });
29
30
        Form::macro('fLabel', function ($name, $value, $required = false, $options = []) {
31
            return str_replace('label', 'span', Form::label($name, $value, $required, $options, false));
32
        });
33
34
        /*        Form::macro('nCancel', function ($title, $options = []) {
35
                    $attributes = array_merge($options, ['class' => 'btn btn-danger fw-bold']);
36
37
                    return Html::link('<i class="mdi mdi-close-outline fw-bolder"></i>&nbsp;&nbsp;' . $title, $attributes, null, false);
38
                });*/
39
    }
40
}
41