coder-studio/bootstrap

1.0.0 2018-06-09 02:46 UTC

This package is not auto-updated.

Last update: 2024-09-22 09:18:39 UTC


README

该软件包允许在Laravel 5.x Blade模板中使用Twitter Bootstrap 4的表单控件。

安装

使用Composer安装Composer。

$ composer require coder-studion/bootstrap

将配置文件中的提供者和别名添加到

'providers' => [
...
CoderStudio\Bootstrap\Providers\BootstrapServiceProvider::class,
]

'aliases' => [
...
'Bootstrap' => CoderStudio\Bootstrap\Facades\Bootstrap::class,
],

元素

Bootstrap::button($name, $value = null);
Bootstrap::checkbox($name, $value = null);
Bootstrap::hidden($name, $value = null);
Bootstrap::password($name, $value = null);
Bootstrap::reset($name, $value = null);
Bootstrap::submit($name, $value = null);
Bootstrap::text($name, $value = null);
Bootstrap::color($name, $value = null);
Bootstrap::date($name, $value = null);
Bootstrap::datetime($name, $value = null);
Bootstrap::datetime_local($name, $value = null);
Bootstrap::email($name, $value = null);
Bootstrap::number($name, $value = null);
Bootstrap::range($name, $value = null);
Bootstrap::search($name, $value = null);
Bootstrap::tel($name, $value = null);
Bootstrap::time($name, $value = null);
Bootstrap::url($name, $value = null);
Bootstrap::month($name, $value = null);
Bootstrap::week($name, $value = null);
Bootstrap::textarea($name, $value = null);
Bootstrap::select($name, $value = null);

方法

label(string $label)
help(string $help)
addonLeft(string $addon_left)
addonRight(string $addon_right)
valid()
invalid()
sm()
lg()
floatingLabel()
params(array $params)
options(array $options)
id(string $id)
cssClass(string $class)
placeholder(string $placeholder)
rows(string $rows)
get()

在Blade模板中的使用

<form method="POST" action="asset('submit')">
    {!! Bootstrap::text('inputName')->label('label name')->placeholder('label name')->floatingLabel()->id("idName")->params()->get() !!}    
</form>