ldc-crm/app/Http/Requests/CustomerDeleteRequest.php
2021-08-02 17:22:56 +02:00

38 lines
831 B
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\Rule;
class CustomerDeleteRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return Auth::check();
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'customer' => 'exists:customers,id|required',
'brand' => 'exists:brands,id|required'
];
}
protected function prepareForValidation()
{
$this->merge(['customer' => $this->route('customer')->id, 'brand' => $this->route('brand')->id]);
}
}