Created
April 24, 2017 07:59
-
-
Save sirawitpra/6ada467078bc159ace2e137cd6dd788c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment