<?php
namespace App\Controller;

use App\Controller\AppController;


class TabConsultationController extends AppController
{

    
    public $components = ['Search'];
    
    public $paginate = [
        'limit'=>25
    ];


    public $searchFields = [
        'index'=>[
            'TabPatient'=>[
                'TabPatient.id'=>[
                    'type'=>'select',
                    'condition'=>'comma',
                    'label'=>'User',
                    'model'=>'TabUser',
                    'selector'=>'getUser',
                ],
                
            ]
        ],
    ];



    public function index()
    {
        $this->loadModel('TabPatient');
        $this->paginate = ['limit'=>10, 'order'=>['TabPatient.id'=>'DESC'], 'contain' => ['TabUser'] ];
        $this->Search->applySearch();
        $patients = $this->paginate($this->TabPatient)->toArray();
        $this->set(compact('patients'));
        if($this->request->is('ajax')) {
            $this->viewBuilder()->layout('ajax');
            $this->render('/Element/index');
        }
        
    }

    
}
