title: Extending DB facade Laravel
body: <p>I would like to convert a timestamp and have some other values related to it. My question is how I can introduce my own method like <code>DB::raw()</code> that appends everything to the current <code>select values</code>.
  So, for instance, for something like this</p>
  
  <pre><code>$user = DB::table('users')
  -&gt;select('*', DB::timestamp('timestamp_column', 'convert_timezone', 'called_as'))
  -&gt;where('id', 1)-&gt;first();
  </code></pre>
  
  <p>Let's assume that I am trying to get the value for <code>created_at</code> column and it's called as <code>converted_created_at</code> and it should return something like below.</p>
  
  <pre><code>{
  id: 1,
  name:'John Doe',
  converted_created_at: {
   'utc_time': 'created_at value as that is in utc by default',
   'converted_time': 'timestamp converted into user timezone',
   'diff': '10 hours ago' // difference between created_at and current timestamp 
  }
  }
  </code></pre>
  
  <p>So, how do I introduce my own method that does this?
  You can take example of any SQL database as you wish.
  I know I can do that with Model but I wanted to see how to approach this problem using a facade.
  Thank you in advance for your help.</p>