title: Calculate Different Integers + Inject new totals to Database
body: <p>I've been searching endlessly for a clue on how I should properly go about creating a "Money Transfer" function (for a game, not real money) within Laravel 4.2. </p>
  
  <p>Needlessly to say, I've come up empty handed and I'm turning to you guys.</p>
  
  <p>The task:</p>
  
  <ul>
  <li>Transfer funds from "Spending" to "Saving" accounts (or vice-versa)</li>
  <li>Subtract the amount from the account it's exiting.</li>
  <li>Add the amount to the account it's entering.</li>
  </ul>
  
  <p>What I need:</p>
  
  <ul>
  <li>A simple calculation to help me get started on building this out. I'm quite new to writing Eloquent and simply need someone to outline how this sort of thing should work.</li>
  </ul>
  
  <p>Database: </p>
  
  <pre><code>id, user_id, spending, saving, bucks, pin, created_at, updated_at
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>class Bank extends Eloquent {
  
      protected $table = 'banks';
      protected $fillable = ['user_id, spending, saving, bucks, pin'];
  
      // Connect to the User
  
      public function user()
      {
          return $this-&gt;belongsTo('User');
      }
  
  }
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>public function transferMoney()
  {
  
      $id = Auth::id();
      $bank = Bank::find($id);
  
      $spending = $bank-&gt;spending;
      $saving = $bank-&gt;saving;
  
      $transfer_type = Input::get('transfer_to');
      $transfer_amount = Input::get('amount');
  
      // Spending to Savings
  
      if($transfer_type = 1) {
          if($transfer_amount &gt;= $spending) {
  
              // the magic to transfer the funds goes here.
  
          }
      }
  
      // Savings to Spending
  
      if($transfer_type = 2) {
          if($transfer_amount &gt;= $savings) {
  
              // the magic to transfer the funds goes here.
  
          }
      }
  }
  </code></pre>
  
  <p>Form in View:</p>
  
  <pre><code>{{ Form::open(array('route' =&gt; array('transferMoney'), 'method' =&gt; 'post')) }}
     {{ Form::select('transfer_to', array('1' =&gt; 'Spending to Saving', '2' =&gt; 'Saving to Spending')) }}
     {{ Form::text('amount', null, ['placeholder' =&gt; 'Amount']) }}
     {{ Form::submit('Transfer', array('class' =&gt; 'button secondary pull-right')) }}
  {{ Form::close() }} 
  </code></pre>
  
  <p>Route:</p>
  
  <pre><code>Route::post('/bank', array('as' =&gt; 'transferMoney', 'uses' =&gt; 'BankController@transferMoney'));
  </code></pre>
  
  <p>Any tips &amp; tricks on best practices are hugely appreciated! 
  Apologies if this repeated - I swear I can't find a solution to this specific roadblock.</p>
  
  <p>Thank you! </p>