title: get user input using Request in laravel and pass it for validation
body: <p>i am new to laravel.Here i have a form where i have to fill up a name field and send it to controllers store() method for validation. Otherwise it will show custom error.But whenever i submit the form with or without input i am getting the following error.</p>
  
  <blockquote>
    <p>Argument 1 passed to Illuminate\Validation\Factory::make() must be of
    the type array, string given, called in
    C:\xampp\htdocs\mylaravel\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php
    on line 221 and defined</p>
  </blockquote>
  
  <p>for experiment purpose i am catching the user input using the following format</p>
  
  <pre><code>$data = $request-&gt;input('name');
  </code></pre>
  
  <p><strong>create.blade.php:</strong></p>
  
  <pre><code>&lt;h1&gt;login form&lt;/h1&gt;
        @if($errors-&gt;has())
          &lt;div&gt;&lt;span&gt; Opps !! &lt;/span&gt;&lt;/br&gt;
            &lt;ul&gt;
              @foreach ($errors-&gt;all() as $error)
                  &lt;li&gt; {{ $error }}&lt;/li&gt;    
              @endforeach
            &lt;/ul&gt;
          &lt;/div&gt;
        @endif
     {!!Form::open(array('url'=&gt;'user','method'=&gt;'POST', 'files'=&gt;true)) !!}
  
     {!!Form::label('name','Your name')!!}
     {!!Form::text('name')!!}
     &lt;/br&gt;
  
     {!!Form::submit('submit')!!}
      {!!Form::close()!!}
  </code></pre>
  
  <p><strong>store() method in userController.php file:</strong></p>
  
  <pre><code>public function store(Request $request)
  {
      //
      $data = $request-&gt;input('name');
  
      $rules = array(
         'name' =&gt; 'unique:users,name|required|alpha_num'
  
      );
  
      // Create a new validator instance.
      $validator = Validator::make($data, $rules);
      if($validator-&gt;fails()){
  
          $errors=$validator-&gt;messages();
          return Redirect::route('user.create')-&gt;withErrors($validator);
  
      }else{
  
              return Redirect::route('user.index');
          }
  
      }
  
  }
  </code></pre>