本文整理汇总了PHP中Room::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Room::all方法的具体用法?PHP Room::all怎么用?PHP Room::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Room
的用法示例。
在下文中一共展示了Room::all方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$rooms = Room::all();
$locations = Location::all();
$menu = 'data';
return View::make('rooms.index', compact('rooms', 'locations', 'menu'));
}
示例2: getRoom
public function getRoom()
{
$date = date('Y-m-d', strtotime(Input::get('date')));
$rtype_id = Input::get('rtype_id');
$reserves = CottageReservation::where('reservation_date', '=', $date)->where('reservation_type', '=', $rtype_id)->get();
if (!empty($reserves)) {
$id = array();
foreach ($reserves as $reserve) {
if (!in_array($reserve['room_id'], $id)) {
$id[count($id)] = $reserve['room_id'];
}
}
$response = array();
$rooms = Room::all();
foreach ($rooms as $room) {
if (!in_array($room['rnid'], $id)) {
$response[] = array("id" => $room['rnid'], "name" => $room['roomname']);
}
}
return $response;
} else {
$rooms = Room::all();
foreach ($rooms as $room) {
$response[] = array("id" => $room['rnid'], "name" => $room['roomname']);
}
return $response;
}
}
示例3: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
// get all the rooms
$rooms = Room::all();
// load the view and pass the rooms
return View::make('rooms.index')->with('rooms', $rooms);
}
示例4: formSelect
public static function formSelect()
{
$result = array();
$result[-1] = "No room";
foreach (Room::all() as $room) {
$result[$room->id] = "Room " . $room->room_code;
}
return $result;
}
示例5: index
public function index()
{
$rooms = Room::all();
$dir = scandir(public_path() . '/room/');
$file = array();
foreach ($dir as $key => $id) {
if (substr($id, 0, 1) !== ".") {
$folder = scandir(public_path() . '/room/' . $id . '/');
$img = array_pop($folder);
$file += [$id => '/room/' . $id . '/' . $img];
}
}
return view('rooms.index', ['rooms' => $rooms, 'file' => $file]);
}
示例6: run
public function run()
{
$faker = Faker\Factory::create();
DB::table('groups')->delete();
DB::table('rooms')->delete();
DB::table('users')->delete();
$group = new Group();
$group->name = "Admin";
$group->permission = "1,2,3,4,5,6";
$group->admin = true;
$group->save();
$group = new Group();
$group->name = "Customer";
$group->permission = "10";
$group->admin = false;
$group->save();
for ($i = 1; $i < 10; $i++) {
$room = new Room();
$room->room_code = sprintf("%03dS", $i);
$room->save();
}
$admin_group = Group::where('name', '=', 'Admin')->first();
$customer_group = Group::where('name', '=', 'Customer')->first();
$user = new User();
$user->username = "admin";
$user->password = Hash::make("passnhulon");
$user->group_id = $admin_group->id;
$user->realname = "Sairen Nguyen";
$user->birthday = "1993-04-05";
$user->email = "t3ngcu00@students.oamk.fi";
$user->save();
for ($i = 1; $i < 10; $i++) {
$user = new User();
$user->username = sprintf("%03dS", $i);
$user->password = Hash::make("passnhulon");
$user->group_id = $customer_group->id;
$user->room_id = Room::all()->first()->id + $i - 1;
$user->realname = $faker->name();
$user->email = $faker->email;
$user->save();
}
}
示例7: isNumber
<label class="control-label">No. of Kids</label>
<input type="text" class="form-control input-sm" id="kid" name="kid"placeholder="" onkeypress="return isNumber(event)">
</div>
<div class="form-group">
<label class="control-label">No. of Adults</label>
<input type="text" class="form-control input-sm" id="adult" name="adult"placeholder=" " onkeypress="return isNumber(event)">
</div>
</div>
<div id="forRoom">
<div id="pT"class="form-group" style="position:relative;">
<label class="control-label" for="inputDefault">Room</label>
<i class="fa fa-2x fa-caret-down" style="position:absolute;right:10px;bottom:2px;color:#000;pointer-events:none;"></i>
<select class="form-control input-sm" id="room" name="room" style="padding-top:0px;padding-left:5px;line-height:20pt;" >
<option value="" disabled selected style="display:none;">Choose room</option>
<?php
$rooms = Room::all();
?>
@foreach($rooms as $room)
<option value = "{{$room['rnid']}}">{{$room['roomname']}}</option>
@endforeach
</select>
</div>
<div id="pT"class="form-group" style="position:relative;">
<label class="control-label" for="inputDefault">Room Package</label>
<i class="fa fa-2x fa-caret-down" style="position:absolute;right:10px;bottom:2px;color:#000;pointer-events:none;"></i>
<select class="form-control input-sm" id="roomPackage" name="roomPackage" style="padding-top:0px;padding-left:5px;line-height:20pt;" >
<option value="" disabled selected style="display:none;">Choose package</option>
<?php
$roomPackages = RoomPackage::all();
?>
@foreach($roomPackages as $package)
示例8: Rooms
public function Rooms($page = '', $perpage = '')
{
$h = new Room();
echo json_encode($h->all());
// or render View
}