Test Failed
Pull Request — main (#21)
by
unknown
12:39 queued 09:00
created

LabelServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 2
eloc 9
c 3
b 0
f 1
dl 0
loc 20
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 15 2
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