46 lines
		
	
	
		
			896 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			896 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Abstracts\Http;
 | |
| 
 | |
| use Illuminate\Foundation\Http\FormRequest as BaseFormRequest;
 | |
| use Illuminate\Support\Arr;
 | |
| 
 | |
| abstract class FormRequest extends BaseFormRequest
 | |
| {
 | |
|     /**
 | |
|      * Prepare the data for validation.
 | |
|      *
 | |
|      * @return void
 | |
|      */
 | |
|     protected function prepareForValidation()
 | |
|     {
 | |
|         $this->merge([
 | |
|             'company_id' => company_id(),
 | |
|         ]);
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Determine if the given offset exists.
 | |
|      *
 | |
|      * @param  string  $offset
 | |
|      * @return bool
 | |
|      */
 | |
|     public function offsetExists($offset)
 | |
|     {
 | |
|         return Arr::has(
 | |
|             $this->route() ? $this->all() + $this->route()->parameters() : $this->all(),
 | |
|             $offset
 | |
|         );
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Determine if the user is authorized to make this request.
 | |
|      *
 | |
|      * @return bool
 | |
|      */
 | |
|     public function authorize()
 | |
|     {
 | |
|         return true;
 | |
|     }
 | |
| }
 |