2018-12-31 11:57:32 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Webkul\Admin\Http\Requests;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
use Illuminate\Validation\Rule;
|
|
|
|
|
|
|
|
|
|
class ConfigurationForm extends FormRequest
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Determine if the Configuraion is authorized to make this request.
|
|
|
|
|
*
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
|
|
|
|
public function authorize()
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the validation rules that apply to the request.
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public function rules()
|
|
|
|
|
{
|
2020-02-05 10:37:00 +00:00
|
|
|
$this->rules = [];
|
|
|
|
|
|
2020-02-28 10:25:53 +00:00
|
|
|
if (request()->has('general.design.admin_logo.logo_image')
|
|
|
|
|
&& ! request()->input('general.design.admin_logo.logo_image.delete')
|
|
|
|
|
) {
|
2020-02-05 10:37:00 +00:00
|
|
|
$this->rules = [
|
2020-03-04 06:32:53 +00:00
|
|
|
'general.design.admin_logo.logo_image' => 'required|mimes:jpeg,bmp,png,jpg',
|
2020-02-05 10:37:00 +00:00
|
|
|
];
|
|
|
|
|
}
|
2018-12-31 11:57:32 +00:00
|
|
|
|
|
|
|
|
return $this->rules;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the error messages for the defined validation rules.
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
2020-02-19 10:26:44 +00:00
|
|
|
*/
|
2018-12-31 11:57:32 +00:00
|
|
|
public function messages()
|
|
|
|
|
{
|
|
|
|
|
return [
|
2020-03-04 06:32:53 +00:00
|
|
|
'general.design.admin_logo.logo_image.mimes' => 'Invalid file format. Use only jpeg, bmp, png, jpg.',
|
2020-07-31 10:35:30 +00:00
|
|
|
'general.design.admin_logo.logo_image.max' => ' Image failed to upload.'
|
2018-12-31 11:57:32 +00:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|