Exemplo n.º 1
0
 public function save()
 {
     $r = Input::all();
     $r['date'] = sqldate($r['date']);
     $r['amount'] = unformat_money($r['amount']);
     $r['user_id'] = Auth::user()->id;
     $r['status'] = User::permitted('role.admin') === true ? 1 : 0;
     //Insert into database
     $created = Expenditure::create($r);
     $data['status'] = 'success';
     $data['message'] = 'Record saved successfully!';
     return Response::json($data);
 }
 public function delete()
 {
     $ids = explode(',', Input::get('javascriptArrayString'));
     Expenditure::destroy($ids);
     $data['status'] = 'success';
     $data['message'] = count($ids) . ' Row(s) was deleted successfully';
     return Response::json($data);
 }