attribute = $attribute; $accept_mime_type = ['image/gif', 'image/png', 'image/jpeg']; $f = finfo_open(); $mime_type = finfo_file($f, $value, FILEINFO_MIME_TYPE); if (!in_array($mime_type, $accept_mime_type)) { return false; } return true; } /** * Get the validation error message. * * @return string */ public function message() { return config('error_code.img_error'); } }