예제 #1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id, $request)
 {
     $apartment = Apartment::find($id);
     $profile = Auth::user()->profile;
     $block_no = $request->input('blockno');
     // get block_no from profileform
     $floor_no = $request->input('floorno');
     // get floor_no from profileform
     //        $profile->apartments()->updateExistingPivot($profile->defaultApartment , ['approved' => '1', 'block_no' => $block_no, 'floor_no' => $floor_no]);
     $profile->apartments()->detach($apartment);
     $profile->apartments()->attach($apartment, ['approved' => '1', 'block_no' => $block_no, 'floor_no' => $floor_no]);
     return redirect()->back()->withMessage('Block / Flat Number Updated')->withStatus('success');
 }
예제 #2
0
 /**
  * Update the specified resource in storage.
  * Store Block / Flat and Floor Number.
  *
  * @param Request $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $apartment = Apartment::find($id);
     $profile = Auth::user()->profile;
     $block_no = $request->input('blockno');
     // get block_no from profileform
     $floor_no = $request->input('floorno');
     // get floor_no from profileform
     $isOwner = $request->input('isOwner');
     // get Owner from profileform
     $lock = $request->input('lock');
     // get lock status from profileform
     $profile->apartments()->detach($apartment);
     $profile->apartments()->attach($apartment, ['approved' => '1', 'block_no' => $block_no, 'floor_no' => $floor_no, 'isOwner' => $isOwner, 'lock' => $lock]);
     return redirect()->back()->withMessage('Block / Flat Number Updated')->withStatus('success');
 }