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


PHP Room::create方法代码示例

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


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

示例1: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Room::create([]);
     }
 }
开发者ID:jonagoldman,项目名称:channelmanager,代码行数:7,代码来源:RoomsTableSeeder.php

示例2: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $rooms = [['name' => 'UB10103', 'building' => 1, 'floor' => 1, 'seats' => 40], ['name' => 'UB10102', 'building' => 1, 'floor' => 1, 'seats' => 40], ['name' => 'UB10101', 'building' => 1, 'floor' => 1, 'seats' => 40], ['name' => 'UB10201', 'building' => 1, 'floor' => 2, 'seats' => 40], ['name' => 'UB10202', 'building' => 1, 'floor' => 2, 'seats' => 40], ['name' => 'UB10203', 'building' => 1, 'floor' => 2, 'seats' => 40], ['name' => 'UB20301', 'building' => 2, 'floor' => 3, 'seats' => 40], ['name' => 'UB20302', 'building' => 2, 'floor' => 3, 'seats' => 40], ['name' => 'UB20303', 'building' => 2, 'floor' => 3, 'seats' => 40], ['name' => 'UB40701', 'building' => 4, 'floor' => 7, 'seats' => 40], ['name' => 'UB40702', 'building' => 4, 'floor' => 7, 'seats' => 40], ['name' => 'UB40703', 'building' => 4, 'floor' => 7, 'seats' => 40], ['name' => 'UB30501', 'building' => 3, 'floor' => 5, 'seats' => 40], ['name' => 'UB30502', 'building' => 3, 'floor' => 5, 'seats' => 40], ['name' => 'UB30503', 'building' => 3, 'floor' => 5, 'seats' => 40], ['name' => 'UB21310', 'building' => 2, 'floor' => 13, 'seats' => 40], ['name' => 'UB21311', 'building' => 2, 'floor' => 13, 'seats' => 40], ['name' => 'UB21312', 'building' => 2, 'floor' => 13, 'seats' => 40]];
     foreach ($rooms as $key => $room) {
         Room::create($room);
     }
 }
开发者ID:atefth,项目名称:CSE371-Project,代码行数:12,代码来源:RoomSeeder.php

示例3: doInsert

function doInsert()
{
    if (isset($_POST['save'])) {
        if ($_POST['rmname'] == "" or $_POST['roomdesc'] == "") {
            message("All field is required!", "error");
            redirect('index.php?view=add');
        } else {
            $room = new Room();
            $rmid = $_POST['roomid'];
            $rmname = $_POST['rmname'];
            $rmdesc = $_POST['roomdesc'];
            $res = $room->find_all_room($rmname);
            if ($res >= 1) {
                message("Room name already exist!", "error");
                redirect('index.php?view=add');
            } else {
                $room->ROOM_NAME = $rmname;
                $room->ROOM_DESC = $rmdesc;
                $istrue = $room->create();
                if ($istrue == 1) {
                    message("New [" . $rmname . "] Room created successfully!", "success");
                    redirect('index.php');
                }
            }
        }
    }
}
开发者ID:allybitebo,项目名称:CCECourseCatalogue,代码行数:27,代码来源:controller.php

示例4: postStore

 /**
  * Store a newly created room in storage.
  *
  * @return Response
  */
 public function postStore()
 {
     $validator = Validator::make($data = Input::all(), Room::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $data['property_id'] = Property::getLoggedId();
     Room::create($data);
     return Redirect::action('RoomsController@getIndex');
 }
开发者ID:jonagoldman,项目名称:channelmanager,代码行数:15,代码来源:RoomsController.php

示例5: createRoom

 public function createRoom()
 {
     $data = Input::only(['name', 'member_number', 'cast_people', 'cast_jinroh', 'cast_knight', 'cast_teller', 'cast_falsewolf', 'cast_freemason', 'cast_mystic', 'cast_betrayer']);
     if (!isset($data['name']) || $data['name'] == '') {
         return Redirect::action('PrepareController@prepareRoom');
     }
     $cast_all = $data['cast_people'] + $data['cast_jinroh'] + $data['cast_teller'] + $data['cast_falsewolf'] + $data['cast_betrayer'] + $data['cast_freemason'] + $data['cast_mystic'] + $data['cast_knight'];
     $room = Room::create(['name' => $data['name'], 'master_id' => 0, 'day' => 0, 'last_saved_from_knight' => 0, 'member_number' => $cast_all, 'state' => 'open', 'cast_people' => $data['cast_people'], 'cast_jinroh' => isset($data['cast_jinroh']) ? $data['cast_jinroh'] : 1, 'cast_knight' => isset($data['cast_knight']) ? $data['cast_knight'] : 0, 'cast_teller' => isset($data['cast_teller']) ? $data['cast_teller'] : 0, 'cast_falsewolf' => isset($data['cast_falsewolf']) ? $data['cast_falsewolf'] : 0, 'cast_betrayer' => isset($data['cast_betrayer']) ? $data['cast_betrayer'] : 0, 'cast_freemason' => isset($data['cast_freemason']) ? $data['cast_freemason'] : 0, 'cast_mystic' => isset($data['cast_mystic']) ? $data['cast_mystic'] : 0]);
     $room->save();
     return Redirect::action('PrepareController@rooms');
 }
开发者ID:asdoda,项目名称:wolfer,代码行数:11,代码来源:PrepareController.php

示例6: postRoom

 public function postRoom()
 {
     //verify the user input and create account
     $validator = Validator::make(Input::all(), array('Name' => 'required|max:200', 'Capacity' => 'required|numeric'));
     if ($validator->fails()) {
         return Redirect::route('admin-post-room')->withErrors($validator)->withInput()->with('global', 'Sorry!! The Room was not posted, please retry.');
     } else {
         $name = Input::get('Name');
         $capacity = Input::get('Capacity');
         $room = Room::create(array('name' => $name, 'capacity' => $capacity));
         if ($room) {
             return View::make('admin.success');
         }
     }
     return Redirect::route('admin-post-room')->withErrors($validator)->withInput()->with('global', 'Sorry!! The Room was not posted, please retry.');
 }
开发者ID:franqq,项目名称:plmas,代码行数:16,代码来源:AdminController.php

示例7: run

 public function run()
 {
     DB::table('rooms')->delete();
     Room::create(array('name' => 'lobby'));
 }
开发者ID:brucewu16899,项目名称:whatup,代码行数:5,代码来源:DefaultRoomsSeeder.php

示例8: trim

$hotel = Hotel::find_by_id($_GET['id']);
if (!$hotel) {
    redirect_to("login.php");
}
if ($session->user_id != $hotel->id) {
    redirect_to("logout.php");
}
if (isset($_POST['submit'])) {
    $room_name = trim($_POST['room_name']);
    $adults = $_POST['adults'];
    $childs = $_POST['childs'];
    $price = trim($_POST['price']);
    $new_room = new Room();
    $new_room->hotel_id = $hotel->id;
    $new_room->make($room_name, $adults, $childs, $price);
    if (empty($new_room->errors) && $new_room->create()) {
        $session->message('Room created');
        redirect_to("add_room.php?id={$hotel->id}&room={$new_room->id}");
    } else {
        $message = join("<br>", $new_room->errors);
    }
}
$room = '';
if (isset($_GET['room']) && !empty($_GET['room'])) {
    $room = Room::find_by_id($_GET['room']);
}
if (isset($_POST['submit1'])) {
    if (!empty($room)) {
        $room_photo = new RoomPhoto();
        $room_photo->room_id = $room->id;
        $room_photo->attach_file($_FILES['upload_file']);
开发者ID:kochevRisto,项目名称:project,代码行数:31,代码来源:add_room.php

示例9: actionCreate

 /**
  * Create a new room
  *
  * @uses Ajax
  */
 public function actionCreate()
 {
     // is this Ajax?
     if ($this->request->isAjax()) {
         $name = $this->request->getPost('name');
         $desc = $this->request->getPost('description');
         $room = new Room();
         // generate a room name for us
         if (empty($name)) {
             $name = $room->newName();
         }
         // save room
         $room->create($name, $desc);
         // 'refresh' rooms listing much like in a lobby
         $system = new System();
         $this->renderJson($system->lobbyRooms($this->user->getId(), $this->user->isAdmin()));
     } else {
         $this->renderTemplate('error404/javascript');
     }
 }
开发者ID:radekstepan,项目名称:Clubhouse,代码行数:25,代码来源:RoomPresenter.php

示例10: exit_with_status_code

                 } else {
                     echo 'The room you are attempting to delete doesn\'t exist';
                     exit_with_status_code(404);
                 }
             default:
                 exit_with_status_code(405);
         }
     }
 } else {
     switch ($verb) {
         case 'POST':
             if (!isset($_REQUEST['name']) || !isset($_REQUEST['admin_id'])) {
                 echo 'Room name and admin ID are required.';
                 exit_with_status_code(400);
             } else {
                 $room = Room::create($_REQUEST['name'], $_REQUEST['admin_id']);
                 if ($room) {
                     echo 'Room successfully created.';
                     exit_with_status_code(201);
                 } else {
                     echo 'Error creating room';
                     exit_with_status_code(400);
                 }
             }
         case 'PUT':
             echo 'Operation not supported';
             exit_with_status_code(405);
         case 'GET':
             $rooms = Room::get();
             if ($rooms) {
                 foreach ($rooms as $room) {
开发者ID:Ollie1700,项目名称:webscrp-coursework,代码行数:31,代码来源:api.1.0.php

示例11: Validate

    if (Token::check(Input::get('token'))) {
        // echo Input::get('surname');
        $validate = new Validate();
        $validation = $validate->check($_POST, array('surname' => array('required' => true, 'min' => 2, 'max' => 32), 'initial' => array('min' => 1, 'max' => 1), 'first_name' => array('required' => true, 'min' => 2, 'max' => 32), 'serial_number' => array('required' => true, 'min' => 32, 'max' => 32, 'unique' => 'devices'), 'year' => array('required' => true), 'model_name' => array('required' => true), 'bgsid' => array('required' => true, 'unique' => 'devices'), 'building_name' => array('required' => true), 'building_location' => array('required' => true), 'room_number' => array('required' => true, 'unique' => 'rooms')));
        if ($validation->passed()) {
            $user = new User();
            $model = new Model();
            $device = new Device();
            $building = new Building();
            $room = new Room();
            try {
                $user->create(array('surname' => Input::get('surname'), 'initial' => Input::get('initial'), 'first_name' => Input::get('first_name')));
                $device->create(array('serial_number' => Input::get('serial_number'), 'year' => Input::get('year'), 'bgsid' => Input::get('bgsid')));
                $model->create(array('model_name' => Input::get('model_name')));
                $building->create(array('building_name' => Input::get('building_name'), 'building_location' => Input::get('building_location')));
                $room->create(array('room_number' => Input::get('room_number')));
                Session::flash('registered', 'The data was send into the database successfully!');
                // header('Location: index.php');
                Redirect::to('index.php');
            } catch (Exception $e) {
                die($e->getMessage());
            }
        } else {
            // print_r($validation->errors());
            foreach ($validation->errors() as $error) {
                echo $error, '<br>';
            }
        }
    }
}
?>
开发者ID:Claodio,项目名称:oophp_project,代码行数:31,代码来源:home.php

示例12: array

 $room->setPrice($price);
 $room->setPersons($persons);
 $room->setIsAvailable($isAvailable);
 if ($isAvailable == 1) {
     $room->setAvailableUntil($availableUntil);
 } else {
     $room->setAvailableUntil("NOT AVAILABLE");
 }
 $room->setDescription($description);
 $room->setHotelId($hotelId);
 if (isset($_POST['roomId'])) {
     $roomId = $database->escapeString($_POST['hotelId']);
     $room->setRoomId($roomId);
     $hotel->update($database);
 } else {
     $roomId = $room->create($database);
 }
 if (count($_FILES) != 0) {
     $error = 0;
     $files = array();
     $uploaddir = "../images/rooms/large/";
     $uploaddirthumb = "../images/rooms/thumb/";
     $nameArray = $_FILES['mediaUploads']['name'];
     $typeArray = $_FILES['mediaUploads']['type'];
     $tmpNameArray = $_FILES['mediaUploads']['tmp_name'];
     $errorArray = $_FILES['mediaUploads']['error'];
     $sizeArray = $_FILES['mediaUploads']['size'];
     for ($count = 0; $count < count($_FILES['mediaUploads']['name']); $count++) {
         $randomNrForName = rand(1, 9999999999.0);
         $target_file = $uploaddir . $randomNrForName . basename($nameArray[$count]);
         $imageFileType = pathinfo($target_file, PATHINFO_EXTENSION);
开发者ID:jetmirhaxhisefa,项目名称:rezervime,代码行数:31,代码来源:createAndEditRoom.php


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