1. Kernel.php 변경
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\TrimStrings::class,
];
2. TrimStrings Middleware
<?php
namespace Illuminate\Foundation\Http\Middleware;
class TrimStrings extends TransformsRequest
{
/**
* The attributes that should not be trimmed.
*
* @var array
*/
protected $except = [
//
];
/**
* Transform the given value.
*
* @param string $key
* @param mixed $value
* @return mixed
*/
protected function transform($key, $value)
{
if (in_array($key, $this->except, true)) {
return $value;
}
return is_string($value) ? trim($value) : $value;
}
}
반응형
'개발 > Laravel' 카테고리의 다른 글
Laravel Socialite와 SocialiteProvider를 활용한 다중인증 소셜로그인 및 동적 URL 처리 (0) | 2021.03.09 |
---|---|
Laravel Mix (0) | 2021.01.19 |
Laravel 라우팅 그룹 설정 (0) | 2020.07.24 |
Laravel Validate Array of Uploaded File (0) | 2020.07.22 |
Laravel Ajax Form Validation (0) | 2020.07.21 |