-
//validator验证 $validator = \Validator::make($request->input(),[ 'student.name' => 'required|min:3|max:12', 'student.age' => 'required|integer', 'student.sex' => 'required|integer', ],[ 'required' => ':attribute 为必填项', 'min' => ':attribute 长度不符合要求', 'max' => ':attribute 长度不符合要求', 'integer' => ':attribute 非法输入', ],[ 'student.name' => '姓名', 'student.age' => '年龄', 'student.sex' => '性别' ]); if($validator->fails()) { return redirect()->back()->withErrors($validator)->withInput(); } 在blade中 使用{{old('student')['name']}} 来保持数据查看全部
-
公共模板建立在views/common/下 公共资源引入使用{{asset(资源路径)}}引入查看全部
-
版本5.1,form表单提交时 -- 需添加隐藏域 <input type="hidden" name="_token" value="{{ csrf_token() }}">查看全部
-
laravel5.1d 的<link rel="stylesheet" href="{{ URL::asset('static/bootstrap/css/bootstrap.min.css') }}"> 或者直接<link rel="stylesheet" href="/static/bootstrap/css/bootstrap.min.css">查看全部
-
模型中定义的方法可以在视图中通过结果集使用{{$student->sex($student->sex)}}查看全部
-
中间件操作: 1、新建中间件:手写,或artisan命令创建 2、注册中间件:在Kernel.php $routeMiddleware属性中加入中间件 3、使用中间件:路由中加入路由组 4、前置和后置操作:将$response=$next($request)置前或置后,$next是下一个操作闭包,$request是请求查看全部
-
// 设置允许模型批量提交 protected $fillable = ['name', 'age', 'sex']; Student::create([]);查看全部
-
// 设置返回时间格式,不做处理 protected function asDateTime($val) { return $val }查看全部
-
// 修改默认时间返回格式为时间戳 protected function getDateFormat() { return time() }查看全部
-
laravvel: 1.controller =>request 获取请求的值 public function request1(Request $request){ $request->input('name','默认'); } 2.dd();将结果打印出来 二 判断请求类型 1.if($request->isMethod('POST')){ echo 'yes'; }else{ echo 'no'; }查看全部
-
1:Laravel中的**Request**请求 >查看url是否拥有某个参数 ``` $request->has('paramter'); ``` >查看所有的request请求数据 ``` $request->all(); ``` >判断请求类型 ``` $request->method(); //获取请求的方法 $request->isMethod('get'); //判断是否是get请求 $request->isMethod('post'); //判断是否是post请求 $request->ajax(); //判断是否是ajax请求 ``` >判断是否是属于某个控制器 ``` $request->is('second/*'); ``` >查看当前的URL路径 ``` $request->url() ```查看全部
-
哈哈查看全部
-
佰港城哦弄查看全部
-
好很多很多都好都好查看全部
-
在循环的时候 @foreach($students as $students)
然后 分页 {{ $students->render() }}
然后就开始出错了。找了好久。才发现 foreach里面 起了一样的别名 然后下面分页就不能用了
查看全部
举报
0/150
提交
取消