From 5797e8c30a41b412beef458f227386688369bcb8 Mon Sep 17 00:00:00 2001 From: cp6 Date: Wed, 8 May 2024 22:01:06 +1000 Subject: [PATCH] Fixed issue 104 --- app/Http/Controllers/OsController.php | 2 +- app/Models/OS.php | 4 ++-- app/View/Components/OsSelect.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/OsController.php b/app/Http/Controllers/OsController.php index 689b6ec..aac4d34 100644 --- a/app/Http/Controllers/OsController.php +++ b/app/Http/Controllers/OsController.php @@ -10,7 +10,7 @@ class OsController extends Controller { public function index() { - $os = OS::allOS(); + $os = OS::allOS()->toArray(); return view('os.index', compact(['os'])); } diff --git a/app/Models/OS.php b/app/Models/OS.php index 01cd59b..3a493a5 100644 --- a/app/Models/OS.php +++ b/app/Models/OS.php @@ -16,10 +16,10 @@ class OS extends Model protected $table = 'os'; - public static function allOS(): array + public static function allOS() { return Cache::remember("operating_systems", now()->addMonth(1), function () { - return self::orderBy('name')->get()->toArray(); + return self::orderBy('name')->get(); }); } } diff --git a/app/View/Components/OsSelect.php b/app/View/Components/OsSelect.php index 2036155..4476f90 100644 --- a/app/View/Components/OsSelect.php +++ b/app/View/Components/OsSelect.php @@ -11,7 +11,7 @@ class OsSelect extends Component public function render() { return view('components.os-select', [ - 'os' => OS::allOS() + 'os' => OS::allOS()->toArray() ]); } }