駐輪場検索画面 並び替え条件修正
This commit is contained in:
parent
dfa786ca6f
commit
0afe05606e
@ -97,6 +97,18 @@ class RegularContractCreateController extends Controller
|
||||
$total = $query->count();
|
||||
$parks_table = $query->skip(($page - 1) * $perPage)->take($perPage)->get();
|
||||
|
||||
if ($sort === 'park_ruby' || $sort === 'station_name_ruby') {
|
||||
setlocale(LC_COLLATE, 'ja_JP.UTF-8');
|
||||
$parks_table = $parks_table->sort(function ($a, $b) use ($order, $sort) {
|
||||
// null対策
|
||||
$a_val = $a->$sort ?? '';
|
||||
$b_val = $b->$sort ?? '';
|
||||
return $order === 'asc'
|
||||
? strcoll($a_val, $b_val)
|
||||
: strcoll($b_val, $a_val);
|
||||
})->values();
|
||||
}
|
||||
|
||||
// zoneテーブルデータを取得(psectionテーブルとJOINしてpsection_subjectも取得)
|
||||
$zones = DB::table('zone')
|
||||
->leftJoin('psection', 'zone.psection_id', '=', 'psection.psection_id')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user