本文整理汇总了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([]);
}
}
示例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);
}
}
示例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');
}
}
}
}
}
示例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');
}
示例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');
}
示例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.');
}
示例7: run
public function run()
{
DB::table('rooms')->delete();
Room::create(array('name' => 'lobby'));
}
示例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']);
示例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');
}
}
示例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) {
示例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>';
}
}
}
}
?>
示例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);