📁 PHP Dosya Yöneticisi
/
/
home
/
demodesigncom
/
otelscripti.demodesign.com.tr
/
admin
/
models
📝
Reservation.php
← Geri Dön
<?php /** * Class Reservation * * @subpackage Controller * @author Fırat ÖZPINAR * @link firat.pl */ class Reservation extends CI_Model { /** * Oda listesini verir * * @return mixed */ public function rooms() { return $this->db->from('rooms')->get()->result(); } /** * İlgili koşula uygun müsaitlik kontrolü yapar * * @param array $kosul * @return mixed */ public function getMusaitlikKontrol($kosul = []) { return $this->db->where($kosul)->get('reservations_musaitlik')->row(); //echo $this->db->last_query(); } public function insertMusaitlik() { $begin = new DateTime($this->input->post('start')); $end = new DateTime($this->input->post('end')); $interval = DateInterval::createFromDateString('1 day'); $period = new DatePeriod($begin, $interval, $end); $toplamGun = iterator_count($period); if ($toplamGun > 30) { return $this->utils->setAlert('danger', 'En fazla 30 gün seçe bilirsiniz'); } foreach ($period as $tarih) { $this->db->insert('reservations_musaitlik',[ 'room_id' => $this->input->post('room'), 'date' => $tarih->format('Y-m-d'), 'musteri' => $this->input->post('musteri'), 'acenta' => $this->input->post('acenta') ]); } } /** * Gelen id değerine göre müsaitliği günceller * * @return mixed */ public function updateMusaitlik() { $this->db->where('id', $this->input->post('id'))->update('reservations_musaitlik', [ 'musteri' => $this->input->post('musteri') ]); return $this->db->affected_rows(); } /** * id * * @param $id * @return mixed */ public function id($id) { return $this->db->from($this->table)->where('id', $id)->get()->row(); } /** * all * * @param null $limit * @return mixed $offset */ public function all($limit = null, $offset = null) { $this->utils->filter(); if ($limit != null) { $this->db->limit($limit, $offset); } return $this->db ->from($this->table) ->order_by('id', 'desc') ->get() ->result(); } public function count() { $this->utils->filter(); return $this->db ->from($this->table) ->count_all_results(); } /** * Oda adını döndürür * * return room row * * **/ public function roomName($record) { return $this->db ->from('rooms') ->where('id', $record->room_id) ->get() ->row(); } public function viewed($record, $data = []) { $this->db ->where('id', $record->id) ->update($this->table, [ 'viewed' => 1 ]); return $this->db->affected_rows(); } public function delete($data) { if (is_array($data)) { $success = $this->db ->where_in('id', $data) ->delete($this->table); return $success; } $success = $this->db ->where('id', $data->id) ->delete($this->table); return $success; } }
💾 Kaydet
İptal
📝 Yeniden Adlandır
İptal
Kaydet
🔐 Dosya İzinleri (chmod)
İzin Değeri:
Hızlı Seçim:
777
755
644
600
777
= Herkes okur/yazar/çalıştırır
755
= Sahip tam, diğerleri okur/çalıştırır
644
= Sahip okur/yazar, diğerleri okur
600
= Sadece sahip okur/yazar
İptal
Uygula