예제 #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Property $property, Request $request)
 {
     //
     $input = $request->except(['payment_id']);
     $payments = $request->only(['payment_id']);
     $input['deposit_date'] = Carbon::parse($input['deposit_date']);
     $input['user_id'] = \Auth::user()->id;
     //Bank Transaction ID is currently a placeholder for a future need/feature
     // $deposit = Deposit::create($input);
     $deposit = $property->deposits()->create($input);
     foreach ($payments['payment_id'] as $p) {
         Payment::where('id', $p)->update(['bank_deposits_id' => $deposit->id]);
     }
     return redirect()->route('properties.deposits.index', ['id' => $property->id]);
 }