Skip to content

Instantly share code, notes, and snippets.

@kamerk22
Last active August 7, 2020 08:30
Show Gist options
  • Save kamerk22/a3ecda8706e775212987a2b952b7adf3 to your computer and use it in GitHub Desktop.
Save kamerk22/a3ecda8706e775212987a2b952b7adf3 to your computer and use it in GitHub Desktop.
<?php
namespace App\Http\Requests;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Http\JsonResponse;
use Waavi\Sanitizer\Laravel\SanitizesInput;
abstract class BaseFormRequest extends FormRequest
{
use SanitizesInput;
/**
* For more sanitizer rule check https://github.com/Waavi/Sanitizer
*/
public function validateResolved()
{
{
$this->sanitize();
parent::validateResolved();
}
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
abstract public function rules();
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
abstract public function authorize();
}
@gabrielalack
Copy link

What is ApiResponse on here? If I use this code it doesn't work and there is no indication of where ApiResponse is supposed to be imported from!

@nleco
Copy link

nleco commented Aug 7, 2020

where does 'ApiResponse' come from?

@kamerk22
Copy link
Author

kamerk22 commented Aug 7, 2020

@nleco
ApiResponse is my own trait to format API resonse according to my requirements. You can skip this. Remove this trait from your implementation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment