Blame view

app/Http/Requests/Request.php 579 Bytes
b7c7a5f6   Alexey Boroda   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  <?php
  
  namespace App\Http\Requests;
  
  use Illuminate\Foundation\Http\FormRequest;
  
  class Request extends FormRequest
  {
  
      /**
       * Set the company id to the request.
       *
       * @return \Illuminate\Contracts\Validation\Validator
       */
      protected function getValidatorInstance()
      {
          // Get request data
          $data = $this->all();
  
          // Add active company id
          $data['company_id'] = session('company_id');
  
          // Reset the request data
          $this->getInputSource()->replace($data);
  
          return parent::getValidatorInstance();
      }
  }