当前位置:网站首页>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
边栏推荐
- Navicat run SQL file import data incomplete or import failed
- Indoor ROS robot navigation commissioning record (experience in selecting expansion radius)
- 数据库系统概论-第一章绪论【概念模型、层次模型和三级模式(外模式、模式、内模式)】
- LeetCode简单题分享(20)
- Realize the IP address home display function and number home query
- Introduction to database system - Chapter 1 introduction [conceptual model, hierarchical model and three-level mode (external mode, mode, internal mode)]
- Introduction and basic use of stored procedures
- Mongodb command summary
- Esp32 ① compilation environment
- Detr introduction
猜你喜欢
Write it down once Net a new energy system thread surge analysis
Help tenants
Battle Atlas: 12 scenarios detailing the requirements for container safety construction
Supply chain supply and demand estimation - [time series]
【黑马早报】华为辟谣“军师”陈春花;恒驰5预售价17.9万元;周杰伦新专辑MV 3小时播放量破亿;法华寺回应万元月薪招人...
高等数学---第八章多元函数微分学1
Getting started with cinnamon applet
How far can it go to adopt a cow by selling the concept to the market?
QQ的药,腾讯的票
566. 重塑矩阵
随机推荐
记一次 .NET 某新能源系统 线程疯涨 分析
Cinnamon taskbar speed
【日常训练】648. 单词替换
2022-7-6 使用SIGURG来接受外带数据,不知道为什么打印不出来
[1] ROS2基础知识-操作命令总结版
648. 单词替换 : 字典树的经典运用
【日常训练--腾讯精选50】231. 2 的幂
Mongodb slice summary
Excerpt from "misogyny: female disgust in Japan"
Drawerlayout suppress sideslip display
flask session伪造之hctf admin
Cmake learning and use notes (1)
Oracle advanced (V) schema solution
Best practice | using Tencent cloud AI willingness to audit as the escort of telephone compliance
Flink | 多流转换
PHP - laravel cache
TPG x AIDU | AI leading talent recruitment plan in progress!
Battle Atlas: 12 scenarios detailing the requirements for container safety construction
Build a secure and trusted computing platform based on Kunpeng's native security
LIS longest ascending subsequence problem (dynamic programming, greed + dichotomy)