several fixes

This commit is contained in:
Denis Duliçi
2021-05-14 18:29:24 +03:00
parent 7ac53681ff
commit b8057a7a12
19 changed files with 165 additions and 75 deletions

View File

@ -26,6 +26,9 @@ class Document extends FormRequest
*/
public function rules()
{
$company_logo = 'nullable';
$attachment = 'nullable';
$type = $this->request->get('type', Model::INVOICE_TYPE);
$type = config('type.' . $type . '.route.parameter');
@ -39,15 +42,11 @@ class Document extends FormRequest
$id = null;
}
$company_logo = 'nullable';
if ($this->request->get('company_logo', null)) {
$company_logo = 'mimes:' . config('filesystems.mimes') . '|between:0,' . config('filesystems.max_size') * 1024;
if ($this->files->get('company_logo')) {
$company_logo = 'mimes:' . config('filesystems.mimes') . '|between:0,' . config('filesystems.max_size') * 1024 . '|dimensions:max_width=1000,max_height=1000';
}
$attachment = 'nullable';
if ($this->request->get('attachment', null)) {
if ($this->files->get('attachment')) {
$attachment = 'mimes:' . config('filesystems.mimes') . '|between:0,' . config('filesystems.max_size') * 1024;
}