Пример #1
0
 public function run()
 {
     DB::table('qbtrans')->delete();
     $collection = [['transaction_id' => '1281', 'loan_id' => 1, 'user_id' => 3, 'qb_date' => '05/30/2015', 'qb_type' => 'LD', 'cat_id' => 7, 'qb_description' => 'Fuel', 'qb_amount' => 50000, 'qb_cat_balance' => 395000, 'qb_total_budget' => 400000, 'qb_total_spent' => 0, 'qb_trans_status' => 'completed'], ['transaction_id' => '1302', 'loan_id' => 1, 'user_id' => 3, 'qb_date' => '06/15/2015', 'qb_type' => 'LD', 'cat_id' => 7, 'qb_description' => 'Fuel', 'qb_amount' => 150000, 'qb_cat_balance' => 200000, 'qb_total_budget' => 400000, 'qb_total_spent' => 50000, 'qb_trans_status' => 'completed'], ['transaction_id' => '1281', 'loan_id' => 1, 'user_id' => 3, 'qb_date' => '06/30/2015', 'qb_type' => 'LD', 'cat_id' => 8, 'qb_description' => 'Labor', 'qb_amount' => 120000, 'qb_cat_balance' => 120000, 'qb_total_budget' => 240000, 'qb_total_spent' => 0, 'qb_trans_status' => 'completed'], ['transaction_id' => '1302', 'loan_id' => 1, 'user_id' => 3, 'qb_date' => '07/15/2015', 'qb_type' => 'LD', 'cat_id' => 7, 'qb_description' => 'Labor', 'qb_amount' => 120000, 'qb_cat_balance' => 0, 'qb_total_budget' => 240000, 'qb_total_spent' => 120000, 'qb_trans_status' => 'completed']];
     foreach ($collection as $record) {
         Qbtran::create($record);
     }
 }
Пример #2
0
 public function update($id)
 {
     // save updated
     $record = $this->records->find($id);
     if (!$record) {
         Qbtran::create(Input::all());
         return $this->respond($record);
     }
     $record->fill(Input::all())->save();
     return $this->respond($record);
 }