
TableSelect::orderby 메서드는 정렬 기준을 지정하는 데 사용됩니다. 이 메서드는 다음과 같은 파라미터를 받습니다.
- string $column : 정렬 기준이 되는 컬럼 이름
- string $direction : 정렬 방향 ('asc' 또는 'desc')
예를 들어, 'created_at' 컬럼을 오름차순으로 정렬하려면 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
php
$table->orderby('created_at', 'asc');
또는, 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
php
$table->orderby('created_at')->asc();
이러한 방법으로, 'created_at' 컬럼을 내림차순으로 정렬하려면 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
php
$table->orderby('created_at', 'desc');
또는, 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
php
$table->orderby('created_at')->desc();
2025-03-30 14:07