当前位置:网站首页>Laravel Form-builder使用
Laravel Form-builder使用
2022-07-07 11:47:00 【全栈程序员站长】
添加formbuilder插件:
Composer应用
composer require kris/laravel-form-builder
下载成功
修改配置文件
在config/app.php
‘providers’ => [
Kris\LaravelFormBuilder\FormBuilderServiceProvider::class,
]
‘aliases’ =>[
'FormBuilder' => Kris\LaravelFormBuilder\Facades\Formbuilder::class,
]
创建form
Php artisan make:form Forms/名字–fields =“name:text,intro:text”
生成的文件
public function buildForm()
{
$this ->add('name', 'text', [ 'rules' => 'required|min:5' ]) ->add('lyrics', 'textarea', [ 'rules' => 'max:5000' ]); }
创建一个空的form
Php artisan make:form Forms/名字
public function buildForm()
{
}
控制器
引用:
use Kris\LaravelFormBuilder\FormBuilder;
函数:
public function create(FormBuilder $formBuilder){ $form = $formBuilder->create(\App\Form\PostForm::class,[ 'method' => 'POST', 'url' => route('photo.store') ]); return view('Photo.form',compact('form')); }
视图:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> </head> <body> {!! form($form) !!} </body> </html>
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/113276.html原文链接:https://javaforall.cn
边栏推荐
- Signal strength (RSSI) knowledge sorting
- [etc.] what are the security objectives and implementation methods that cloud computing security expansion requires to focus on?
- Thread pool reject policy best practices
- LeetCode_二分搜索_中等_153.寻找旋转排序数组中的最小值
- 室內ROS機器人導航調試記錄(膨脹半徑的選取經驗)
- Redis只能做缓存?太out了!
- [1] ROS2基础知识-操作命令总结版
- Use of polarscatter function in MATLAB
- Data refresh of recyclerview
- Enregistrement de la navigation et de la mise en service du robot ROS intérieur (expérience de sélection du rayon de dilatation)
猜你喜欢
My "troublesome" subordinates after 00: not bad for money, against leaders, and resist overtime
Redis can only cache? Too out!
Supply chain supply and demand estimation - [time series]
实现IP地址归属地显示功能、号码归属地查询
[dark horse morning post] Huawei refutes rumors about "military master" Chen Chunhua; Hengchi 5 has a pre-sale price of 179000 yuan; Jay Chou's new album MV has played more than 100 million in 3 hours
Talk about pseudo sharing
Write it down once Net a new energy system thread surge analysis
2022-7-7 Leetcode 844.比较含退格的字符串
靠卖概念上市,认养一头牛能走多远?
C语言数组相关问题深度理解
随机推荐
Realbasicvsr test pictures and videos
华为镜像地址
Supply chain supply and demand estimation - [time series]
Realize the IP address home display function and number home query
Getting started with MySQL
实现IP地址归属地显示功能、号码归属地查询
Leecode3. Longest substring without repeated characters
Read PG in data warehouse in one article_ stat
How far can it go to adopt a cow by selling the concept to the market?
2022-7-6 beginner redis (I) download, install and run redis under Linux
Error lnk2019: unresolved external symbol
. Net core about redis pipeline and transactions
Learning breakout 2 - about effective learning methods
Toraw and markraw
clion mingw64中文乱码
How did Guotai Junan Securities open an account? Is it safe to open an account?
提升树莓派性能的方法
现在网上开户安全么?那么网上开户选哪个证券公司?
High end for 8 years, how is Yadi now?
QQ的药,腾讯的票