duanjipiao7076 2018-06-27 02:35
浏览 110

使用Bootstrap Modal进行Laravel验证

I've included this Github script to make a validation form with Bootstrap Modal everything is set up correctly but when I included this script the form don't submit because there are some errors which is good but it doesn't show them in the view

Controller

$this->validate($request, [
    'nom' => 'required|unique:filieres'
]);

View

@if($errors->get('nom'))
    @foreach($errors->get('nom') as $error)
        <li class="has-error">{{$error}}</li>
    @endforeach
@endif
  • 写回答

1条回答 默认 最新

  • douao1854 2018-06-27 04:41
    关注

    can you just type this code in your view file

            @include('includes.form_error')
    

    second type this in your controller

        public function store(UsersRequest $request)
        {
        }
    

    and you create UserRequest file in Requests folder and type this

        public function rules()
        {
            return [
                'name' => 'required',
            ];
        }
    

    after you got proper error

    评论

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序