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


PHP Room::find方法代码示例

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


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

示例1: join

 public function join()
 {
     $data = Input::only(['name', 'room_id']);
     print_r($data);
     $room = Room::find($data['room_id']);
     if (!$room) {
         return Redirect::action('PrepareController@room');
     }
     if ($room->state !== 'open') {
         throw new BadRequestHttpException('既にゲームは開始しています。');
     }
     if ($room->mates->count() >= $room->member_number) {
         throw new BadRequestHttpException('全ユーザーが揃っています');
     }
     if (!isset($data['name']) || $data['name'] == '') {
         //名前指定していない場合
         return Redirect::action('PrepareController@rooms');
     }
     $i = 0;
     do {
         $hash = sha1(date("Y/m/d H:i:s.u") . 'zCeZu12X' . $data['name'] . $data['room_id']);
         $hashed_mate = Mate::where('hash', $hash)->select('hash')->first();
         $i++;
         if ($i > 50) {
             throw new InternalErrorException('ユーザー作成に失敗しました hash衝突しまくり');
         }
     } while ($hashed_mate && $i < 100);
     $mate = Mate::create(['name' => $data['name'], 'last_state' => 'open', 'hash' => $hash, 'cast_id' => 0, 'room_id' => $data['room_id'], 'select_user_id' => '', 'is_alive' => 1]);
     if (!$mate) {
         throw new InternalErrorException('ユーザー作成に失敗しました');
     }
     $room->touch();
     return Redirect::action('PlayController@index', ['hash' => $hash]);
 }
开发者ID:asdoda,项目名称:wolfer,代码行数:34,代码来源:PrepareController.php

示例2: getDelete

 public function getDelete($id)
 {
     $room = Room::find($id);
     $room->delete();
     Session::flash('message', 'The records are deleted successfully');
     return Redirect::to('rooms');
 }
开发者ID:andrinda,项目名称:myhotel,代码行数:7,代码来源:RoomsController.php

示例3: deleteRoom

 public function deleteRoom($buildingid, $id)
 {
     //
     $room = Room::find($id);
     $room->delete();
     return Redirect::to('/building/' . $buildingid);
 }
开发者ID:axelardu,项目名称:festic-partner,代码行数:7,代码来源:DesignerController.php

示例4: getMap

 /**
  * Show the form for editing the specified room.
  *
  * @param int $id
  * @param int $channelId
  * @return Response
  */
 public function getMap($id, $channelId)
 {
     $room = Room::find($id);
     $channelSettings = PropertiesChannel::getSettings($channelId, Property::getLoggedId());
     $channel = ChannelFactory::create($channelSettings);
     $result = $channel->getInventoryList();
     //todo temp
     //        file_put_contents('1.txt', serialize($result));
     //        $result = unserialize(file_get_contents('1.txt'));
     //add Inventories and Plans to DB//TODO move to another place
     //delete exist maps
     Inventory::where(['channel_id' => $channelId, 'property_id' => $channelSettings->property_id])->delete();
     //delete exist plan maps
     InventoryPlan::where(['channel_id' => $channelId, 'property_id' => $channelSettings->property_id])->delete();
     if ($result) {
         foreach ($result as $inventory) {
             Inventory::create(['code' => $inventory['code'], 'name' => $inventory['name'], 'channel_id' => $channelId, 'property_id' => $channelSettings->property_id]);
             if ($inventory['plans']) {
                 foreach ($inventory['plans'] as $plan) {
                     InventoryPlan::create(['code' => $plan['code'], 'name' => $plan['name'], 'channel_id' => $channelId, 'inventory_code' => $inventory['code'], 'property_id' => $channelSettings->property_id]);
                 }
             }
         }
     }
     $existMapping = [];
     //        $mapCollection = InventoryMap::where(
     //            [
     //                'channel_id' => $channelId,
     //                'property_id' => $channelSettings->property_id
     //            ]
     //        )
     ////            ->where('room_id', '<>', $id)
     //            ->lists('inventory_code', 'room_id');
     //        if ($mapCollection) {
     //            foreach ($mapCollection as $map) {
     //                $existMapping[] = $map;
     //            }
     //        }>F
     $inventories = Channel::find($channelId)->inventory()->where('property_id', Property::getLoggedId());
     $inventoryList = [];
     $inventoryPlans = [];
     foreach ($inventories->get() as $inventory) {
         //            if (in_array($inventory->code, $existMapping)) {
         //                continue;
         //            }
         $inventoryList[$inventory->code] = $inventory->name;
         $plans = $inventory->plans()->get(['name', 'code']);
         for ($i = 0; $i < count($plans); $i++) {
             //TODO rewrite to ONE query
             $plans[$i]->selected = InventoryMap::getByKeys($channelId, $channelSettings->property_id, $id, $plans[$i]['code'])->first() ? true : false;
         }
         $inventoryPlans[$inventory->code] = $plans;
     }
     $inventoryPlans = json_encode($inventoryPlans);
     $mapping = InventoryMap::getByKeys($channelId, $channelSettings->property_id, $id)->first();
     return View::make('rooms.map', compact('room', 'channel', 'inventoryList', 'inventoryPlans', 'channelId', 'mapping'));
 }
开发者ID:jonagoldman,项目名称:channelmanager,代码行数:64,代码来源:RoomsController.php

示例5: ajax_loadRoom

 public function ajax_loadRoom()
 {
     $query = $this->__getQuery();
     $returnCode = new AjaxReturn();
     if (!$this->__initInfoFromQuery()) {
         return $returnCode->error('room is missing');
     }
     if (!$this->__joinsThisRoom()) {
         return $returnCode->error('not joined the room');
     }
     $callTime = 0;
     while ($callTime < 30) {
         // masterのみの追加処理
         if ($this->myInfo->ismaster()) {
             if ($this->__checkState() === 'open' && $this->room->sitDownAllMate()) {
                 $this->__advanceState('open');
                 break;
             }
             //状態が変化した場合に、情報を知らせる
             if ($this->__hasChangedState()) {
                 if (isset($this->room->last_dead_user_id)) {
                     $returnCode->add('dead', $this->room->last_dead_user_id);
                     break;
                 }
             } else {
                 if ($this->room->state == 'end') {
                     $returnCode->add('result', $this->__checkTriumph());
                     break;
                 }
             }
             //最後に全員が選択済みであれば自動的に進める
             $result = $this->__allSelectStateFlow();
             $result |= $this->__timedStateFlow();
             if ($result) {
                 break;
             }
             // master is clear
             if ($this->__checkstate() === 'open' && $this->room->sitdownallmate()) {
                 $this->__advancestate('open');
                 break;
             }
         }
         // 初回のみLongPollingなし
         if (!isset($query['state']) || $query['state'] === '') {
             break;
         }
         $newRoom = Room::find($this->room->id);
         if ($newRoom->updated_at > $this->room->updated_at) {
             $this->room = $newRoom;
             $this->room->mates = Mate::where('room_id', $newRoom->id)->get();
             break;
         }
         $callTime += 3;
         usleep(3000 * 1000);
     }
     //$returnCode->add('jsstate', $this->getJSState());
     $returnCode->add('state', $this->__getState());
     $returnCode->add('room', $this->room);
     $returnCode->add('mates', $this->room->mates);
     $returnCode->add('myInfo', $this->myInfo);
     $returnCode->add('myCast', $this->myInfo->cast);
     //print_r($this->myInfo->cast());
     return $returnCode->success();
 }
开发者ID:asdoda,项目名称:wolfer,代码行数:64,代码来源:PlayController.php

示例6: post_delete

    public function post_delete($city, $id, $delkey)
    {
        $rules = array('id' => 'required', 'delkey' => 'required|max:60', 'email' => 'required|email');
        $values = array('id' => $id, 'delkey' => $delkey, 'email' => Input::get('email'));
        $v = Validator::make($values, $rules);
        $room = Room::find($id);
        if ($v->fails()) {
            return View::make('home.room')->with('del', '<div id="delModal" class="modal hide" tabindex="-1" role="dialog" aria-hidden="true"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button><h3 id="myModalLabel">Kamer verwijderen</h3></div><div class="modal-body"><p>Vul ter verificatie je e-mailadres in om de kamer te verwijderen.</p><form action="' . $delkey . '" method="post" class="form-horizontal"><div class="control-group"><label class="control-label" for="email">Email:</label><div class="controls"><input type="email" name="email" class="span8" placeholder="Je e-mail" data-validations="required|email"><p class="error-bottom">Vul a.u.b een emailadres in</p></div></div><div class="control-group"><label class="control-label" for="reason">Reden:</label><div class="controls"><label class="radio"><input type="radio" name="reason" value="Verhuurd"> <strong>Huisgenoot gevonden, bedankt!</strong></label><label class="radio"><input type="radio" name="reason" value="Andere kamerwebsite"> Verhuurd via andere kamerwebsite</label><label class="radio"><input type="radio" name="reason" value="Geen reacties"> Geen reacties gekregen</label><label class="radio"><input type="radio" name="reason" value="Ontevreden"> Ontevreden over kamergenood</label></div></div></div><div class="modal-footer"><button class="btn btn-danger" type="submit">Verwijder kamer</button></form></div></div>')->with('room', $room);
        } else {
            if ($room->delkey == $delkey && $room->email == Input::get('email')) {
                $room->delete();
                $path_kamer_folder = 'public_html/img/room/' . $id;
                File::rmdir($path_kamer_folder);
                return Redirect::to('kamer-verhuren');
            } else {
                return View::make('home.room')->with('del', '<div id="delModal" class="modal hide" tabindex="-1" role="dialog" aria-hidden="true"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button><h3 id="myModalLabel">Kamer verwijderen</h3></div><div class="modal-body"><div class="alert alert-error"><strong>Onjuist emailadres!</strong> Dit emailadres is niet bekend bij ons
</div><form action="' . $delkey . '" method="post" class="form-horizontal"><div class="control-group"><label class="control-label" for="email">Email:</label><div class="controls"><input type="email" name="email" class="span8" placeholder="Je e-mail" data-validations="required|email"></div></div><div class="control-group"><label class="control-label" for="reason">Reden:</label><div class="controls"><label class="radio"><input type="radio" name="reason" value="Verhuurd"> <strong>Huisgenoot gevonden, bedankt!</strong></label><label class="radio"><input type="radio" name="reason" value="Andere kamerwebsite"> Verhuurd via andere kamerwebsite</label><label class="radio"><input type="radio" name="reason" value="Geen reacties"> Geen reacties gekregen</label><label class="radio"><input type="radio" name="reason" value="Ontevreden"> Ontevreden over kamergenood</label></div></div></div><div class="modal-footer"><button class="btn btn-danger" type="submit">Verwijder kamer</button></form></div></div>')->with('room', $room);
            }
        }
    }
开发者ID:sanneterpstra,项目名称:Kamergenood,代码行数:20,代码来源:rooms.php

示例7: getPrice

 public function getPrice($id)
 {
     $data = Room::find($id);
     $array[] = array('number' => $data->number, 'price' => $data->type->price);
     echo json_encode($array);
 }
开发者ID:andrinda,项目名称:myhotel,代码行数:6,代码来源:BookingController.php

示例8: __checkTriumph

 protected function __checkTriumph()
 {
     $remainNumbers = ['jinroh' => 0, 'people' => 0];
     $latestRoomData = Room::find($this->room->id);
     foreach ($latestRoomData->mates->all() as $mate) {
         if ($mate->is_alive == 0) {
             continue;
         }
         if ($latestRoomData->last_dead_user_id === $mate->id) {
             continue;
         }
         if ($mate->cast->jinroh_team == 1) {
             $remainNumbers['jinroh']++;
         } else {
             $remainNumbers['people']++;
         }
     }
     if ($remainNumbers['jinroh'] <= 0) {
         return 'people';
         //市民の勝利
     } else {
         if ($remainNumbers['people'] <= $remainNumbers['jinroh']) {
             return 'jinroh';
             //人狼の勝利
         }
     }
     return null;
     // 勝負がついていない
 }
开发者ID:asdoda,项目名称:wolfer,代码行数:29,代码来源:JinrohController.php

示例9: get_edit

 public function get_edit($id)
 {
     $room = Room::find($id);
     return View::make('admin.rooms.edit')->with('room', $room);
 }
开发者ID:sanneterpstra,项目名称:Kamergenood,代码行数:5,代码来源:room.php

示例10: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     // delete
     $room = Room::find($id);
     $room->delete();
     // redirect
     Session::flash('message', 'Successfully deleted the room!');
     return Redirect::to('rooms');
 }
开发者ID:ehumps,项目名称:rendezview,代码行数:15,代码来源:RoomController.php


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