|
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> ' . $title, $attributes, null, false); |
|
38
|
|
|
});*/ |
|
39
|
|
|
} |
|
40
|
|
|
} |
|
41
|
|
|
|