Skip to content

Instantly share code, notes, and snippets.

@jamierumbelow
Last active October 24, 2017 10:27
Show Gist options
  • Save jamierumbelow/7a077190549aef07310d4f6c010b5b4b to your computer and use it in GitHub Desktop.
Save jamierumbelow/7a077190549aef07310d4f6c010b5b4b to your computer and use it in GitHub Desktop.
<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #557799">&lt;?php</span>
<span style="color: #008800; font-weight: bold">use</span> Illuminate\Contracts\Encryption\Encrypter;
<span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">function</span> <span style="color: #0066BB; font-weight: bold">getEmailAttribute</span>(<span style="color: #996633">$value</span>)
{
<span style="color: #008800; font-weight: bold">return</span> <span style="color: #996633">$value</span> <span style="color: #333333">?</span> app(Encrypter<span style="color: #333333">::</span><span style="color: #0000CC">class</span>)<span style="color: #333333">-&gt;</span><span style="color: #0000CC">decrypt</span>(<span style="color: #996633">$value</span>) <span style="color: #333333">:</span> <span style="color: #008800; font-weight: bold">null</span>;
}
<span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">function</span> <span style="color: #0066BB; font-weight: bold">setEmailAttribute</span>(<span style="color: #996633">$value</span>)
{
<span style="color: #008800; font-weight: bold">return</span> <span style="color: #996633">$this</span><span style="color: #333333">-&gt;</span><span style="color: #0000CC">attributes</span>[<span style="background-color: #fff0f0">&#39;email&#39;</span>] <span style="color: #333333">=</span> <span style="color: #996633">$value</span> <span style="color: #333333">?</span> app(Encrypter<span style="color: #333333">::</span><span style="color: #0000CC">class</span>)<span style="color: #333333">-&gt;</span><span style="color: #0000CC">encrypt</span>(<span style="color: #996633">$value</span>) <span style="color: #333333">:</span> <span style="color: #008800; font-weight: bold">null</span>;
}
</pre></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment