当前位置:网站首页>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
边栏推荐
- Learning breakout 2 - about effective learning methods
- 2022-7-6 beginner redis (I) download, install and run redis under Linux
- C语言数组相关问题深度理解
- Storage principle inside mongodb
- 【日常训练】648. 单词替换
- 现在网上开户安全么?那么网上开户选哪个证券公司?
- 记一次 .NET 某新能源系统 线程疯涨 分析
- QQ medicine, Tencent ticket
- Mongodb slice summary
- What parameters need to be reconfigured to replace the new radar of ROS robot
猜你喜欢
Vscode编辑器ESP32头文件波浪线不跳转彻底解决
2022-7-7 Leetcode 844.比较含退格的字符串
2022-7-6 Leetcode 977.有序数组的平方
Getting started with cinnamon applet
TPG x AIDU | AI leading talent recruitment plan in progress!
Best practice | using Tencent cloud AI willingness to audit as the escort of telephone compliance
《厌女:日本的女性嫌恶》摘录
The delivery efficiency is increased by 52 times, and the operation efficiency is increased by 10 times. See the compilation of practical cases of financial cloud native technology (with download)
QQ的药,腾讯的票
社会责任·价值共创,中关村网络安全与信息化产业联盟对话网信企业家海泰方圆董事长姜海舟先生
随机推荐
PHP - laravel cache
2022-7-6 初学redis(一)在 Linux 下下载安装并运行 redis
Mongodb command summary
"New red flag Cup" desktop application creativity competition 2022
Vscade editor esp32 header file wavy line does not jump completely solved
DID登陆-MetaMask
[daily training] 648 Word replacement
如何让join跑得更快?
toRaw和markRaw
Some principles of mongodb optimization
Supply chain supply and demand estimation - [time series]
单片机学习笔记之点亮led 灯
Split screen bug notes
Indoor ROS robot navigation commissioning record (experience in selecting expansion radius)
[fortress machine] what is the difference between cloud fortress machine and ordinary fortress machine?
QQ medicine, Tencent ticket
ESP32 ① 编译环境
[1] ROS2基础知识-操作命令总结版
LeetCode简单题分享(20)
我那“不好惹”的00后下属:不差钱,怼领导,抵制加班