title: How to modify Request values in laravel?
body: <p>I have the following code,</p>
  
  <p>my question is how to modify Request values?</p>
  
  <pre><code>public function store(CategoryRequest $request)
  {
      try {
          $request['slug'] = str_slug($request['name'], '_');
          if ($request-&gt;file('image')-&gt;isValid()) {
              $file = $request-&gt;file('image');
              $destinationPath = public_path('images/category_images');
              $fileName = str_random('16') . '.' . $file-&gt;getClientOriginalExtension();
              $request-&gt;image = $fileName;
              echo $request['image'];
              $file-&gt;move($destinationPath, $fileName);
              Category::create($request-&gt;all());
              return redirect('category');
          }
      } catch (FileException $exception) {
          throw $exception;
      }
  }
  </code></pre>
  
  <p>But,</p>
  
  <p>on each request the output of</p>
  
  <pre><code>echo $request['image'];
  </code></pre>
  
  <p>outputs some text like /tmp/phpDPTsIn</p>