57 lines
1.0 KiB
PHP
57 lines
1.0 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Requests;
|
||
|
|
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
|
||
|
|
class StoreNotesRequest extends FormRequest
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Determine if the user is authorized to make this request.
|
||
|
|
*
|
||
|
|
* @return bool
|
||
|
|
*/
|
||
|
|
public function authorize()
|
||
|
|
{
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get custom attributes for validator errors.
|
||
|
|
*
|
||
|
|
* @return array
|
||
|
|
*/
|
||
|
|
public function attributes()
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'lead_id' => 'lead',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the validation rules that apply to the request.
|
||
|
|
*
|
||
|
|
* @return array
|
||
|
|
*/
|
||
|
|
public function rules()
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'leads_id' => 'required',
|
||
|
|
'notes' => 'required',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function messages(){
|
||
|
|
return [
|
||
|
|
'required' => 'The :attribute field is required.',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function validated()
|
||
|
|
{
|
||
|
|
return array_merge(parent::validated(), [
|
||
|
|
'created_by' => auth()->user()->id
|
||
|
|
]);
|
||
|
|
}
|
||
|
|
}
|