php - laravel validation add custom var -
i wan't give user ability limit upload file size.
$uploadsize = settings::where('id','=','1')->first(); $upsz=$uploadsize->uploadsize; $upmz="'max:".$upsz."'"; $this->validate($request, [ 'file' => $upmz, 'file' => 'mimes:doc,docx,xslx,ppt,pptx,zip,rar,pdf', ]);
and throws out error
method [validate'max] not exist.
you have quotes, correct:
$upmz="max:".$upsz.""; $this->validate($request, [ 'file' => $upmz, 'file' => 'mimes:doc,docx,xslx,ppt,pptx,zip,rar,pdf', ]);
Comments
Post a Comment