From 81a1989e80ed88871a92e3db2dfb7b5299ae877a Mon Sep 17 00:00:00 2001 From: philipp lang Date: Sun, 20 Mar 2022 12:20:01 +0100 Subject: [PATCH] Fixed: Get all regions --- app/Http/Views/MemberView.php | 2 ++ app/Region.php | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/app/Http/Views/MemberView.php b/app/Http/Views/MemberView.php index 2de82bc7..8415c1e0 100644 --- a/app/Http/Views/MemberView.php +++ b/app/Http/Views/MemberView.php @@ -11,6 +11,7 @@ use App\Payment\Payment; use App\Payment\PaymentResource; use App\Payment\Status; use App\Payment\Subscription; +use App\Region; use App\Subactivity; use Illuminate\Http\Request; @@ -34,6 +35,7 @@ class MemberView 'paymentDefaults' => ['nr' => date('Y')], 'subscriptions' => Subscription::pluck('name', 'id'), 'statuses' => Status::pluck('name', 'id'), + 'regions' => Region::forSelect(), 'activities' => $activities->pluck('name', 'id'), 'courses' => Course::pluck('name', 'id'), 'subactivities' => $activities->map(function (Activity $activity) { diff --git a/app/Region.php b/app/Region.php index c302e9d5..5a9ba256 100644 --- a/app/Region.php +++ b/app/Region.php @@ -2,6 +2,7 @@ namespace App; +use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Model; class Region extends Model @@ -13,4 +14,9 @@ class Region extends Model public $casts = [ 'is_null' => 'boolean', ]; + + public static function forSelect(): Collection + { + return static::select('id', 'name')->get(); + } }