my-idlers/app/Models/OS.php
cp6 c24056c511 Fix for issue 89
Locations, OS and Providers now Alpha-Sorted correctly
2023-03-20 10:37:28 +11:00

27 lines
573 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
class OS extends Model
{
use HasFactory;
protected $fillable = ['name'];
protected $keyType = 'string';
protected $table = 'os';
public static function allOS(): array
{
return Cache::remember("operating_systems", now()->addMonth(1), function () {
return DB::table('os')->orderBy('name')->get()->toArray();
});
}
}