cakephp

Alphabetical order in cakephp


Architecture
Business
Computer Service
Documentation
Electronic
Finance
ICT,Internet
Infrastructure
Manufacture
Medical
Others (Public office ,etc)
Trading Company

This is my option value order and I make it according to alphabetic order but I want "Others (Public office , etc) "in my last one.

How could I change it to become it?


Solution

  • You can use something like this (in controller)

    $list = $this->YourModel->find('all' , [
            'order' => [
                'title' => 'ASC'
            ]
        ])
    ->toArray();
    
    $this->set(compact('list'));