Files

35 lines
1.0 KiB
PHP
Raw Permalink Normal View History

2026-01-24 14:03:11 +00:00
<?php
return [
'sample_one' => [
'model' => \App\MyModel::class,
'cols' => "name,code",
'select' => ['id as value', 'name as label']
],
'sample_two' => [
'fn' => function ($query) {
return \App\DB\MyModel::whereHas('cls', function ($q) {
return $q->where('term_id', 2)->where('teacher_id', 1);
})
->select(['id as value', 'title as label'])
->where('title', 'LIKE', '%' . $query . '%')
->orWhere('code', 'LIKE', '%' . $query . '%')
->get()
->toArray();
},
],
'sample_three' => [
'model' => \App\DB\MyModel::class,
'cols' => "title",
'where' => [['sts', '>', '0']],
'select' => ['id as value', 'title as label']
],
'sample_four' => [
'model' => \App\DB\MyModel::class,
'cols' => "title",
'where' => [['w', 'course_level']],
'select' => ['id as value', 'title as label']
]
];