You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
459 B
18 lines
459 B
<?php
|
|
|
|
namespace App\Domains\Academic\Queries\Lookup;
|
|
|
|
use App\Domains\Academic\Models\Term;
|
|
use Illuminate\Support\Collection;
|
|
|
|
class TermLookup
|
|
{
|
|
public static function fetch($search = null): Collection
|
|
{
|
|
return once(fn () => Term::query()
|
|
->select(['name'])
|
|
->when($search, fn ($query) => $query->where('name', 'like', "%{$search}%"))
|
|
->latest('date_start')
|
|
->pluck('name', 'name'));
|
|
}
|
|
}
|
|
|