当前位置:网站首页>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
边栏推荐
- [daily training -- Tencent select 50] 231 Power of 2
- 数字ic设计——SPI
- 提升树莓派性能的方法
- Fast development board pinctrl and GPIO subsystem experiment for itop-imx6ull - modify the device tree file
- 2022-7-6 sigurg is used to receive external data. I don't know why it can't be printed out
- Error lnk2019: unresolved external symbol
- Help tenants
- [etc.] what are the security objectives and implementation methods that cloud computing security expansion requires to focus on?
- LeetCode_二分搜索_中等_153.寻找旋转排序数组中的最小值
- [high frequency interview questions] difficulty 2.5/5, simple combination of DFS trie template level application questions
猜你喜欢

Flink | 多流转换

QQ medicine, Tencent ticket

Enregistrement de la navigation et de la mise en service du robot ROS intérieur (expérience de sélection du rayon de dilatation)

MySQL error 28 and solution

Social responsibility · value co creation, Zhongguancun network security and Information Industry Alliance dialogue, wechat entrepreneur Haitai Fangyuan, chairman Mr. Jiang Haizhou

【堡垒机】云堡垒机和普通堡垒机的区别是什么?

交付效率提升52倍,运营效率提升10倍,看《金融云原生技术实践案例汇编》(附下载)

flask session伪造之hctf admin

xshell连接服务器把密钥登陆改为密码登陆

Introduce six open source protocols in detail (instructions for programmers)
随机推荐
Some principles of mongodb optimization
Leetcode simple question sharing (20)
[high frequency interview questions] difficulty 2.5/5, simple combination of DFS trie template level application questions
Oracle advanced (V) schema solution
靠卖概念上市,认养一头牛能走多远?
Ogre introduction
QQ medicine, Tencent ticket
2022-7-6 beginner redis (I) download, install and run redis under Linux
2022-7-7 Leetcode 34. Find the first and last positions of elements in a sorted array
Leecode3. Longest substring without repeated characters
MySQL error 28 and solution
How far can it go to adopt a cow by selling the concept to the market?
Ways to improve the performance of raspberry pie
LeetCode简单题分享(20)
数据库系统概论-第一章绪论【概念模型、层次模型和三级模式(外模式、模式、内模式)】
[QNX hypervisor 2.2 user manual]6.3.4 virtual register (guest_shm.h)
118. 杨辉三角
[daily training -- Tencent select 50] 231 Power of 2
ESP32构解工程添加组件
Introduce six open source protocols in detail (instructions for programmers)