示例#1
0
 public static function getAll()
 {
     $requet = new User();
     echo '<pre>';
     print_r($_REQUEST);
     echo '</pre>';
     return $requet->all();
 }
示例#2
0
 public function store(Requests\User $request)
 {
     $all = $request->all();
     \App\Book::create($all);
     echo '<pre>';
     print_r($all);
     die;
     return redirect('books');
 }
示例#3
0
文件: User.php 项目: pavhov93/blog2
 public static function getRulesArray()
 {
     $rulesArray = [];
     $requset = new User();
     $rules = $requset->rules();
     foreach ($rules as $index => $rule) {
         $rule = explode('|', $rules[$index]);
         foreach ($rule as $i => $item) {
             $rulesArray[$index][$i] = $item;
         }
     }
     return $rulesArray;
 }
示例#4
0
@extends('layouts.app')

@section('content')
    <?php 
$rules = \App\Http\Requests\User::getRulesArray();
?>
    <div class="container">
        <div class="row">
            <div class="col-md-10 col-md-offset-1">
                <div class="panel panel-default">
                    <div class="panel-heading">Register</div>
                    <div class="panel-body">
                        <form class="form-horizontal" role="form" method="POST" action="{{ url('/register') }}"
                              enctype="multipart/form-data">
                            {!! csrf_field() !!}

                            <div class="form-group{{ $errors->has('fname') ? ' has-error' : '' }}" data-role="fname">
                                <label class="col-md-4 control-label" for="fname">First Name</label>

                                <div class="col-md-6">
                                    <input id="fname" type="text" class="form-control input-sm" name="fname"
                                           value="{{ old('fname') }}"
                                            {{isset($rules['fname'])?'data-role='.json_encode($rules['fname']):''}}>
                                    <span class="help-block">
                                    @if ($errors->has('fname'))
                                            <b>{{ $errors->first('fname') }}</b>
                                        @endif
                                    </span>
                                </div>
                            </div>
                            <div class="form-group{{ $errors->has('lname') ? ' has-error' : '' }}" data-role="lname">
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\User $request)
 {
     User::create(['name' => $request->input('name'), 'email' => $request->input('email'), 'password' => bcrypt($request->input('password'))]);
     return redirect('/home');
 }