Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save residential-map-machine-user/365da4dfe414225448afa003fcf302c8 to your computer and use it in GitHub Desktop.
Save residential-map-machine-user/365da4dfe414225448afa003fcf302c8 to your computer and use it in GitHub Desktop.
<?php
namespace App\Controller\Approval;
use App\Controller\AppController;
use Cake\ORM\TableRegistry;
use Cake\I18n\Time;
/**
* RestaurantReservationsManagesController Controller
*
* @property \App\Model\Table\RestaurantReservationsManagesTable $RestaurantReservationsManages
*
* @method \App\Model\Entity\RestaurantReservationsManages[] paginate($object = null, array $settings = [])
*/
class RestaurantReservationsManagesController extends AppController
{
/**
* Initialize method
*
*/
public function initialize() {
parent::initialize();
$this->RestaurantReservations = TableRegistry::get('RestaurantReservations', [
'className' => 'App\Model\Table\Restaurant\RestaurantReservationsTable'
]);
}
/**
* 予約一覧画面用のアクション (表)
*
*
* @access public
* @return \Cake\Http\Response|null
*/
public function displayAll()
{
$now = Time::now();
$afterReserve = $this->RestaurantReservations->getDayReserve($now);
$this->set(compact('afterReserve'));
}
/**
* 予約一覧画面用のアクション(座席)
*
*
* @access public
* @return \Cake\Http\Response|null
*/
public function displaySeat()
{
$reservations = $this->paginate($this->RestaurantReservations);
$this->set(compact('reservations'));
$this->set('_serialize', ['reservations']);
}
/**
* 予約一覧画面用のアクション(レジ裏)
*
*
* @access public
* @return \Cake\Http\Response|null
*/
public function seatChart()
{
$reservations = $this->paginate($this->RestaurantReservations);
$this->set(compact('reservations'));
$this->set('_serialize', ['reservations']);
}
/**
* 予約詳細画面のアクション
*
* @param string|null $id RestaurantRreservation id.
* @return \Cake\Http\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
//$reservation = $this->RestaurantReservations->get($id, [
// 'contain' => []
//]);
//$this->set('reservation', $reservation);
$this->set('_serialize', ['reservation']);
}
/**
* 予約追加画面用のアクション
*
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$reservation = $this->RestaurantReservations->newEntity();
if ($this->request->is('post')) {
$reservation = $this->RestaurantReservations->patchEntity($reservation, $this->request->getData());
if ($this->RestaurantReservations->save($reservation)) {
$this->Flash->success(__('The RestaurantReservation has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The RestaurantReservation could not be saved. Please, try again.'));
}
$this->set(compact('reservation'));
$this->set('_serialize', ['reservation']);
}
/**
* 予約内容編集画面用のアクション
*
* @param string|null $id RestaurantReservation id.
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
//$reservation = $this->RestaurantReservations->get($id, [
// 'contain' => []
//]);
if ($this->request->is(['patch', 'post', 'put'])) {
$reservation = $this->RestaurantReservations->patchEntity($reservation, $this->request->getData());
if ($this->RestaurantReservations->save($reservation)) {
$this->Flash->success(__('The RestaurantRreservation has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The RestaurantReservation could not be saved. Please, try again.'));
}
$this->set(compact('reservation'));
$this->set('_serialize', ['reservation']);
}
/**
* 予約削除用のアクション
*
* @param string|null $id RestaurantReservation id.
* @return \Cake\Http\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$reservation = $this->RestaurantReservations->get($id);
if ($this->RestaurantReservations->delete($reservation)) {
$this->Flash->success(__('The RestaurantReservation has been deleted.'));
} else {
$this->Flash->error(__('The RestaurantReservation could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}
<?php
namespace App\Controller\Approval;
use App\Controller\AppController;
use Cake\ORM\TableRegistry;
use Cake\I18n\Time;
/**
* RestaurantReservationsManagesController Controller
*
* @property \App\Model\Table\RestaurantReservationsManagesTable $RestaurantReservationsManages
*
* @method \App\Model\Entity\RestaurantReservationsManages[] paginate($object = null, array $settings = [])
*/
class RestaurantReservationsManagesController extends AppController
{
/**
* Initialize method
*
*/
public function initialize() {
parent::initialize();
$this->RestaurantReservations = TableRegistry::get('RestaurantReservations', [
'className' => 'App\Model\Table\Restaurant\RestaurantReservationsTable'
]);
}
/**
* 予約一覧画面用のアクション (表)
*
*
* @access public
* @return \Cake\Http\Response|null
*/
public function displayAll()
{
$now = Time::now();
$afterReserve = $this->RestaurantReservations->getDayReserve($now);
$this->set(compact('afterReserve'));
}
/**
* 予約一覧画面用のアクション(座席)
*
*
* @access public
* @return \Cake\Http\Response|null
*/
public function displaySeat()
{
$reservations = $this->paginate($this->RestaurantReservations);
$this->set(compact('reservations'));
$this->set('_serialize', ['reservations']);
}
/**
* 予約一覧画面用のアクション(レジ裏)
*
*
* @access public
* @return \Cake\Http\Response|null
*/
public function seatChart()
{
$reservations = $this->paginate($this->RestaurantReservations);
$this->set(compact('reservations'));
$this->set('_serialize', ['reservations']);
}
/**
* 予約詳細画面のアクション
*
* @param string|null $id RestaurantRreservation id.
* @return \Cake\Http\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
//$reservation = $this->RestaurantReservations->get($id, [
// 'contain' => []
//]);
//$this->set('reservation', $reservation);
$this->set('_serialize', ['reservation']);
}
/**
* 予約追加画面用のアクション
*
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$reservation = $this->RestaurantReservations->newEntity();
if ($this->request->is('post')) {
$reservation = $this->RestaurantReservations->patchEntity($reservation, $this->request->getData());
if ($this->RestaurantReservations->save($reservation)) {
$this->Flash->success(__('The RestaurantReservation has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The RestaurantReservation could not be saved. Please, try again.'));
}
$this->set(compact('reservation'));
$this->set('_serialize', ['reservation']);
}
/**
* 予約内容編集画面用のアクション
*
* @param string|null $id RestaurantReservation id.
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
//$reservation = $this->RestaurantReservations->get($id, [
// 'contain' => []
//]);
if ($this->request->is(['patch', 'post', 'put'])) {
$reservation = $this->RestaurantReservations->patchEntity($reservation, $this->request->getData());
if ($this->RestaurantReservations->save($reservation)) {
$this->Flash->success(__('The RestaurantRreservation has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The RestaurantReservation could not be saved. Please, try again.'));
}
$this->set(compact('reservation'));
$this->set('_serialize', ['reservation']);
}
/**
* 予約削除用のアクション
*
* @param string|null $id RestaurantReservation id.
* @return \Cake\Http\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$reservation = $this->RestaurantReservations->get($id);
if ($this->RestaurantReservations->delete($reservation)) {
$this->Flash->success(__('The RestaurantReservation has been deleted.'));
} else {
$this->Flash->error(__('The RestaurantReservation could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment