本文整理汇总了PHP中Apartment::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Apartment::find方法的具体用法?PHP Apartment::find怎么用?PHP Apartment::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Apartment
的用法示例。
在下文中一共展示了Apartment::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
/**
* 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: update
/**
* 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');
}