Fixed: Get all regions
continuous-integration/drone/push Build is passing Details

This commit is contained in:
philipp lang 2022-03-20 12:20:01 +01:00
parent 92b23244da
commit 81a1989e80
2 changed files with 8 additions and 0 deletions

View File

@ -11,6 +11,7 @@ use App\Payment\Payment;
use App\Payment\PaymentResource; use App\Payment\PaymentResource;
use App\Payment\Status; use App\Payment\Status;
use App\Payment\Subscription; use App\Payment\Subscription;
use App\Region;
use App\Subactivity; use App\Subactivity;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@ -34,6 +35,7 @@ class MemberView
'paymentDefaults' => ['nr' => date('Y')], 'paymentDefaults' => ['nr' => date('Y')],
'subscriptions' => Subscription::pluck('name', 'id'), 'subscriptions' => Subscription::pluck('name', 'id'),
'statuses' => Status::pluck('name', 'id'), 'statuses' => Status::pluck('name', 'id'),
'regions' => Region::forSelect(),
'activities' => $activities->pluck('name', 'id'), 'activities' => $activities->pluck('name', 'id'),
'courses' => Course::pluck('name', 'id'), 'courses' => Course::pluck('name', 'id'),
'subactivities' => $activities->map(function (Activity $activity) { 'subactivities' => $activities->map(function (Activity $activity) {

View File

@ -2,6 +2,7 @@
namespace App; namespace App;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Region extends Model class Region extends Model
@ -13,4 +14,9 @@ class Region extends Model
public $casts = [ public $casts = [
'is_null' => 'boolean', 'is_null' => 'boolean',
]; ];
public static function forSelect(): Collection
{
return static::select('id', 'name')->get();
}
} }