当前位置: 首页>>代码示例>>PHP>>正文


PHP Room::findOrFail方法代码示例

本文整理汇总了PHP中Room::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Room::findOrFail方法的具体用法?PHP Room::findOrFail怎么用?PHP Room::findOrFail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Room的用法示例。


在下文中一共展示了Room::findOrFail方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 public function update($id)
 {
     $room = Room::findOrFail($id);
     $room->location_id = Input::get('location');
     $room->name = Input::get('name');
     $room->capacity = Input::get('capacity');
     $room->save();
     Session::flash('message', 'Sukses mengupdate ruangan!');
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:9,代码来源:RoomsController.php

示例2: postUpdate

 /**
  * Update the specified room in storage.
  *
  * @param  int $id
  * @return Response
  */
 public function postUpdate($id)
 {
     $room = Room::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Room::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $room->update($data);
     return Redirect::action('RoomsController@getIndex');
 }
开发者ID:jonagoldman,项目名称:channelmanager,代码行数:16,代码来源:RoomsController.php

示例3: postUpdateRates

 public function postUpdateRates()
 {
     $rules = ['from_date' => 'required|date_format:Y-m-d|after:' . date('Y-m-d', strtotime('yesterday')), 'to_date' => 'required|date_format:Y-m-d|after:' . date('Y-m-d', strtotime('yesterday')), 'week_day' => 'required', 'rooms' => 'required', 'rate' => 'required|numeric|min:0', 'single_rate' => 'numeric|min:0'];
     $validator = Validator::make($data = Input::all(), $rules);
     if ($validator->fails()) {
         return Response::json(['success' => false, 'errors' => $validator->getMessageBag()->toArray()], 400);
         //400 - http error code
     }
     //all ok so get rooms and plans mapping
     $weekDays = $data['week_day'];
     $errors = [];
     $property = Property::findOrFail(Property::getLoggedId());
     foreach ($data['rooms'] as $roomId) {
         //get room data
         $room = Room::findOrFail($roomId);
         $depth = 0;
         $this->updateChannelRate($room, $property, $data, $data['rate'], $weekDays, $errors, $depth);
     }
     if (!empty($errors)) {
         return Response::json(['success' => false, 'errors' => $errors], 400);
         //400 - http error code
     }
     return Response::json(['success' => true], 200);
     //200 - http success code
 }
开发者ID:jonagoldman,项目名称:channelmanager,代码行数:25,代码来源:BulkController.php

示例4: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     // get the room
     $room = Room::findOrFail($id);
     // show the edit form and pass the room
     return View::make('rooms.edit')->with('room', $room);
 }
开发者ID:ehumps,项目名称:rendezview,代码行数:13,代码来源:RoomController.php


注:本文中的Room::findOrFail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。