Tommy
Tommy

Reputation: 9

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?

Upvotes: 0

Views: 678

Answers (1)

Dariusz Majchrzak
Dariusz Majchrzak

Reputation: 1237

You can use something like this (in controller)

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

$this->set(compact('list'));

Upvotes: 1

Related Questions