在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):glhd/aire开源软件地址(OpenSource Url):https://github.com/glhd/aire开源编程语言(OpenSource Language):PHP 83.3%开源软件介绍(OpenSource Introduction):Aire is a modern Laravel form builder (demo) with a focus on the same expressive and beautiful code you expect from the Laravel ecosystem. Basic UsageThe most common usage is via the {{ Aire::open()
->route('users.update')
->bind($user) }}
{{ Aire::input('given_name', 'First/Given Name')
->id('given_name') }}
{{ Aire::input('family_name', 'Last/Family Name')
->id('family_name')
->autoComplete('off') }}
{{ Aire::email('email', 'Email Address')
->helpText('Please use your company email address.') }}
{{ Aire::submit('Update User') }}
{{ Aire::close() }} Blade ComponentsAs of Aire 2.4.0, you can also use all Aire elements as Blade Components. The above form is identical to: <x-aire::form route="users.update" :bind="$user">
<x-aire::input
name="given_name"
label="First/Given Name"
id="given_name"
/>
<x-aire::input
name="family_name"
label="Last/Family Name"
id="family_name"
auto-complete="off"
/>
<x-aire::email
name="email"
label="Email Address"
help-text="Please use your company email address."
/>
<x-aire::submit label="Update User" />
</x-aire::form> InstallationInstall via composer with: composer require glhd/aire CustomizationAire comes with classes that should work with the default Tailwind class names
out of the box ( The first is to publish the return [
'default_classes' => [
'input' => 'text-gray-900 bg-white border rounded-sm',
],
]; The second option is to publish custom views via ConfigurationWhen you publish the Data BindingAire automatically binds old input to your form so that values are preserved if a validation
error occurs. You can also bind data with the // Bind Eloquent models
Aire::bind(User::find(1));
// Bind an array
Aire::bind(['given_name' => 'Chris']);
// Bind any object
Aire::bind((object) ['given_name' => 'Chris']); Binding PrecedenceBinding is applied in the following order:
Method Spoofing & InferenceAire will automatically add the Laravel // In routes
Route::delete('/photos/{photo}', 'PhotosController@destroy')
->name('photos.destroy');
// In your view
{{ Aire::open()->route('photos.destroy', $photo) }}
{{ Aire::close() }} Will generate the resulting HTML: <form action="/photos/1" method="POST">
<input type="hidden" name="_method" value="DELETE" />
</form> Automatic CSRF FieldAire will automatically inject a CSRF token if one exists and the form is not a Server-Side ValidationIf you run validations on the server, Aire will pick up any errors and automatically apply error classes and show error messages within the associated input's group. You can also include an error summary, which provides an easy way to show your users an error at the top of the page if validation failed. // Print "There are X errors on this page that you must fix before continuing."
{{ Aire::summary() }}
// Also include an itemized list of errors
{{ Aire::summary()->verbose() }} Client-Side ValidationJavascript validation in Aire is in its early stages. Browser testing is limited, and the
Javascript code hasn't had an performance optimizations applied. That said, Aire
supports automatic client-side validation—simply pass an array of rules or a Laravel Version SupportAire should run on Laravel 5.8.28 and higher, and PHP 7.1 and higher. Our policy is to test the last two major releases of PHP and Laravel, so support below that is not guaranteed. TranslationsAire comes with support for a handful of languages (feel free to submit a PR!). If you would like to add your own translations, you can do so by publishing them with: php artisan vendor:publish --tag=aire-translations Under Consideration / Feature IdeasThere are a few things that are still either in-the-works or being considered for a later release. These include:
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论