Skip to content
Permalink
Browse files Browse the repository at this point in the history
adds and uses strToHex helper
  • Loading branch information
saleh-old committed Aug 25, 2017
1 parent 610084a commit ee6a322
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions app/Http/helpers.php
Expand Up @@ -201,3 +201,20 @@ function iso8601($time)
return gmdate('c', strtotime($time));
}
}

if (!function_exists('strToHex')) {
/**
* Converts timestamp to ISO8601 format.
*
* @param string $string
*
* @return string
*/
function strToHex($string) {
$hex = bin2hex($string);
$hex = chunk_split($hex, 2, "\\x");
$hex = "\\x" . substr($hex, 0, -2);

return $hex;
}
}
2 changes: 1 addition & 1 deletion resources/views/layouts/app.blade.php
Expand Up @@ -69,7 +69,7 @@
<script>
var auth = {
id: '{{ Auth::user()->id }}',
bio: `{!! Auth::user()->bio !!}`,
bio: '{!! strToHex(Auth::user()->bio) !!}',
name: '{{ Auth::user()->name }}',
email: '{{ Auth::user()->email }}',
color: '{{ Auth::user()->color }}',
Expand Down

0 comments on commit ee6a322

Please sign in to comment.