PHP Cs Fixer
This commit is contained in:
parent
f0256f39e7
commit
d0c18fb78c
|
@ -10,7 +10,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
|
||||||
class Activity extends Model
|
class Activity extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
use HasNamiField;
|
use HasNamiField;
|
||||||
use Sluggable;
|
use Sluggable;
|
||||||
|
@ -19,7 +18,7 @@ class Activity extends Model
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
public $casts = [
|
public $casts = [
|
||||||
'nami_id' => 'integer'
|
'nami_id' => 'integer',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function sluggable(): array
|
public function sluggable(): array
|
||||||
|
@ -31,8 +30,8 @@ class Activity extends Model
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function subactivities(): BelongsToMany {
|
public function subactivities(): BelongsToMany
|
||||||
|
{
|
||||||
return $this->belongsToMany(Subactivity::class);
|
return $this->belongsToMany(Subactivity::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Confession extends Model
|
class Confession extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
public $fillable = ['name', 'nami_id', 'is_null'];
|
public $fillable = ['name', 'nami_id', 'is_null'];
|
||||||
|
|
|
@ -4,7 +4,6 @@ namespace App\Console\Commands;
|
||||||
|
|
||||||
use App\Initialize\Initializer;
|
use App\Initialize\Initializer;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Zoomyboy\LaravelNami\Nami;
|
|
||||||
use Zoomyboy\LaravelNami\NamiException;
|
use Zoomyboy\LaravelNami\NamiException;
|
||||||
|
|
||||||
class NamiInitializeCommand extends Command
|
class NamiInitializeCommand extends Command
|
||||||
|
@ -44,6 +43,7 @@ class NamiInitializeCommand extends Command
|
||||||
app(Initializer::class)->run();
|
app(Initializer::class)->run();
|
||||||
} catch (NamiException $e) {
|
} catch (NamiException $e) {
|
||||||
$e->outputToConsole($this);
|
$e->outputToConsole($this);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,14 +13,13 @@ class Kernel extends ConsoleKernel
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $commands = [
|
protected $commands = [
|
||||||
PaymentSendCommand::class,
|
PaymentSendCommand::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the application's command schedule.
|
* Define the application's command schedule.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function schedule(Schedule $schedule)
|
protected function schedule(Schedule $schedule)
|
||||||
|
|
|
@ -13,7 +13,8 @@ class Country extends Model
|
||||||
|
|
||||||
public $fillable = ['name', 'nami_id'];
|
public $fillable = ['name', 'nami_id'];
|
||||||
|
|
||||||
public static function default(): int {
|
public static function default(): int
|
||||||
|
{
|
||||||
return self::whereName('Deutschland')->firstOrFail()->id;
|
return self::whereName('Deutschland')->firstOrFail()->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ use App\Http\Controllers\Controller;
|
||||||
use App\Member\Member;
|
use App\Member\Member;
|
||||||
use App\Setting\NamiSettings;
|
use App\Setting\NamiSettings;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
|
|
||||||
class CourseController extends Controller
|
class CourseController extends Controller
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,14 +2,10 @@
|
||||||
|
|
||||||
namespace App\Course\Requests;
|
namespace App\Course\Requests;
|
||||||
|
|
||||||
use App\Course\Models\Course;
|
|
||||||
use App\Course\Models\CourseMember;
|
use App\Course\Models\CourseMember;
|
||||||
use App\Member\Member;
|
use App\Member\Member;
|
||||||
use App\Setting\NamiSettings;
|
use App\Setting\NamiSettings;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Support\Arr;
|
|
||||||
use Illuminate\Validation\ValidationException;
|
|
||||||
use Zoomyboy\LaravelNami\NamiException;
|
|
||||||
|
|
||||||
class DestroyRequest extends FormRequest
|
class DestroyRequest extends FormRequest
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,14 +6,9 @@ use App\Course\Models\Course;
|
||||||
use App\Member\Member;
|
use App\Member\Member;
|
||||||
use App\Setting\NamiSettings;
|
use App\Setting\NamiSettings;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Support\Arr;
|
|
||||||
use Illuminate\Validation\ValidationException;
|
|
||||||
use Zoomyboy\LaravelNami\Nami;
|
|
||||||
use Zoomyboy\LaravelNami\NamiException;
|
|
||||||
|
|
||||||
class StoreRequest extends FormRequest
|
class StoreRequest extends FormRequest
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the user is authorized to make this request.
|
* Determine if the user is authorized to make this request.
|
||||||
*
|
*
|
||||||
|
@ -51,5 +46,4 @@ class StoreRequest extends FormRequest
|
||||||
|
|
||||||
$member->courses()->create($this->safe()->collect()->put('nami_id', $namiId)->toArray());
|
$member->courses()->create($this->safe()->collect()->put('nami_id', $namiId)->toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,6 @@ use App\Course\Models\CourseMember;
|
||||||
use App\Member\Member;
|
use App\Member\Member;
|
||||||
use App\Setting\NamiSettings;
|
use App\Setting\NamiSettings;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Support\Arr;
|
|
||||||
use Illuminate\Validation\ValidationException;
|
|
||||||
use Zoomyboy\LaravelNami\NamiException;
|
|
||||||
|
|
||||||
class UpdateRequest extends FormRequest
|
class UpdateRequest extends FormRequest
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,8 @@ class CourseResource extends JsonResource
|
||||||
/**
|
/**
|
||||||
* Transform the resource into an array.
|
* Transform the resource into an array.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
|
*
|
||||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
||||||
*/
|
*/
|
||||||
public function toArray($request)
|
public function toArray($request)
|
||||||
|
|
|
@ -6,7 +6,6 @@ use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||||
use Illuminate\Validation\ValidationException;
|
use Illuminate\Validation\ValidationException;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
use Zoomyboy\LaravelNami\LoginException;
|
use Zoomyboy\LaravelNami\LoginException;
|
||||||
use Zoomyboy\LaravelNami\NamiException;
|
|
||||||
|
|
||||||
class Handler extends ExceptionHandler
|
class Handler extends ExceptionHandler
|
||||||
{
|
{
|
||||||
|
@ -16,7 +15,6 @@ class Handler extends ExceptionHandler
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
protected $dontReport = [
|
protected $dontReport = [
|
||||||
//
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,7 +30,6 @@ class Handler extends ExceptionHandler
|
||||||
/**
|
/**
|
||||||
* Report or log an exception.
|
* Report or log an exception.
|
||||||
*
|
*
|
||||||
* @param \Throwable $exception
|
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
|
@ -45,8 +42,8 @@ class Handler extends ExceptionHandler
|
||||||
/**
|
/**
|
||||||
* Render an exception into an HTTP response.
|
* Render an exception into an HTTP response.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @param \Throwable $exception
|
*
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
* @throws \Throwable
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
use App\Member\Member;
|
|
||||||
use App\Payment\Subscription;
|
use App\Payment\Subscription;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
|
@ -7,7 +7,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Gender extends Model
|
class Gender extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
use HasNamiField;
|
use HasNamiField;
|
||||||
|
|
||||||
public $fillable = ['name', 'nami_id'];
|
public $fillable = ['name', 'nami_id'];
|
||||||
|
|
|
@ -39,8 +39,8 @@ class LoginController extends Controller
|
||||||
$this->middleware('guest')->except('logout');
|
$this->middleware('guest')->except('logout');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function showLoginForm(): Response {
|
public function showLoginForm(): Response
|
||||||
|
{
|
||||||
return \Inertia::render('VLogin');
|
return \Inertia::render('VLogin');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,6 @@ class RegisterController extends Controller
|
||||||
/**
|
/**
|
||||||
* Get a validator for an incoming registration request.
|
* Get a validator for an incoming registration request.
|
||||||
*
|
*
|
||||||
* @param array $data
|
|
||||||
* @return \Illuminate\Contracts\Validation\Validator
|
* @return \Illuminate\Contracts\Validation\Validator
|
||||||
*/
|
*/
|
||||||
protected function validator(array $data)
|
protected function validator(array $data)
|
||||||
|
@ -59,7 +58,6 @@ class RegisterController extends Controller
|
||||||
/**
|
/**
|
||||||
* Create a new user instance after a valid registration.
|
* Create a new user instance after a valid registration.
|
||||||
*
|
*
|
||||||
* @param array $data
|
|
||||||
* @return \App\User
|
* @return \App\User
|
||||||
*/
|
*/
|
||||||
protected function create(array $data)
|
protected function create(array $data)
|
||||||
|
|
|
@ -9,5 +9,7 @@ use Illuminate\Routing\Controller as BaseController;
|
||||||
|
|
||||||
abstract class Controller extends BaseController
|
abstract class Controller extends BaseController
|
||||||
{
|
{
|
||||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
use AuthorizesRequests;
|
||||||
|
use DispatchesJobs;
|
||||||
|
use ValidatesRequests;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Kernel extends HttpKernel
|
||||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
\App\Http\Middleware\InertiaShareMiddleware::class,
|
\App\Http\Middleware\InertiaShareMiddleware::class,
|
||||||
\App\Http\Middleware\RedirectIfNotInitializedMiddleware::class
|
\App\Http\Middleware\RedirectIfNotInitializedMiddleware::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
'api' => [
|
'api' => [
|
||||||
|
|
|
@ -9,12 +9,13 @@ class Authenticate extends Middleware
|
||||||
/**
|
/**
|
||||||
* Get the path the user should be redirected to when they are not authenticated.
|
* Get the path the user should be redirected to when they are not authenticated.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
|
*
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
protected function redirectTo($request)
|
protected function redirectTo($request)
|
||||||
{
|
{
|
||||||
if (! $request->expectsJson()) {
|
if (!$request->expectsJson()) {
|
||||||
return route('login');
|
return route('login');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,5 @@ class CheckForMaintenanceMode extends Middleware
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $except = [
|
protected $except = [
|
||||||
//
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,5 @@ class EncryptCookies extends Middleware
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $except = [
|
protected $except = [
|
||||||
//
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,12 +9,11 @@ use Session;
|
||||||
|
|
||||||
class InertiaShareMiddleware
|
class InertiaShareMiddleware
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @param \Closure $next
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next)
|
public function handle($request, Closure $next)
|
||||||
|
@ -23,7 +22,7 @@ class InertiaShareMiddleware
|
||||||
'auth' => ['user' => auth()->check() ? new UserResource(auth()->user()) : null],
|
'auth' => ['user' => auth()->check() ? new UserResource(auth()->user()) : null],
|
||||||
'search' => $request->query('search', ''),
|
'search' => $request->query('search', ''),
|
||||||
'flash' => session()->get('flash'),
|
'flash' => session()->get('flash'),
|
||||||
'menu' => function() {
|
'menu' => function () {
|
||||||
return session()->get('menu');
|
return session()->get('menu');
|
||||||
},
|
},
|
||||||
'errors' => function () {
|
'errors' => function () {
|
||||||
|
@ -31,12 +30,12 @@ class InertiaShareMiddleware
|
||||||
? Session::get('errors')->getBag('default')->getMessages()
|
? Session::get('errors')->getBag('default')->getMessages()
|
||||||
: (object) [];
|
: (object) [];
|
||||||
},
|
},
|
||||||
'title' => function() {
|
'title' => function () {
|
||||||
return session()->get('title', '');
|
return session()->get('title', '');
|
||||||
},
|
},
|
||||||
'settings' => [
|
'settings' => [
|
||||||
'modules' => app(GeneralSettings::class)->modules,
|
'modules' => app(GeneralSettings::class)->modules,
|
||||||
]
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$response = $next($request);
|
$response = $next($request);
|
||||||
|
|
|
@ -11,9 +11,9 @@ class RedirectIfAuthenticated
|
||||||
/**
|
/**
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @param \Closure $next
|
* @param string|null $guard
|
||||||
* @param string|null $guard
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next, $guard = null)
|
public function handle($request, Closure $next, $guard = null)
|
||||||
|
|
|
@ -6,19 +6,18 @@ use Closure;
|
||||||
|
|
||||||
class RedirectIfNotInitializedMiddleware
|
class RedirectIfNotInitializedMiddleware
|
||||||
{
|
{
|
||||||
|
|
||||||
public array $dontRedirect = ['initialize.index', 'initialize.store'];
|
public array $dontRedirect = ['initialize.index', 'initialize.store'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @param \Closure $next
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next)
|
public function handle($request, Closure $next)
|
||||||
{
|
{
|
||||||
if(!$this->shouldRedirect()) {
|
if (!$this->shouldRedirect()) {
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,5 @@ class VerifyCsrfToken extends Middleware
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $except = [
|
protected $except = [
|
||||||
//
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,8 @@ class UserResource extends JsonResource
|
||||||
/**
|
/**
|
||||||
* Transform the resource into an array.
|
* Transform the resource into an array.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function toArray($request)
|
public function toArray($request)
|
||||||
|
@ -22,8 +23,8 @@ class UserResource extends JsonResource
|
||||||
'name' => $this->name,
|
'name' => $this->name,
|
||||||
'email' => $this->email,
|
'email' => $this->email,
|
||||||
'avatar' => [
|
'avatar' => [
|
||||||
'src' => Storage::url('avatar.png')
|
'src' => Storage::url('avatar.png'),
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,14 +3,11 @@
|
||||||
namespace App\Http\Views;
|
namespace App\Http\Views;
|
||||||
|
|
||||||
use App\Member\Member;
|
use App\Member\Member;
|
||||||
use App\Member\MemberResource;
|
|
||||||
use App\Payment\Payment;
|
use App\Payment\Payment;
|
||||||
use App\Payment\PaymentResource;
|
|
||||||
use App\Payment\Status;
|
|
||||||
use App\Payment\Subscription;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class HomeView {
|
class HomeView
|
||||||
|
{
|
||||||
public function index(Request $request): array
|
public function index(Request $request): array
|
||||||
{
|
{
|
||||||
/** @var object{a: string} */
|
/** @var object{a: string} */
|
||||||
|
@ -22,7 +19,7 @@ class HomeView {
|
||||||
'payments' => [
|
'payments' => [
|
||||||
'users' => $members,
|
'users' => $members,
|
||||||
'all_users' => Member::count(),
|
'all_users' => Member::count(),
|
||||||
'amount' => number_format($amount->a / 100, 2, ',', '.').' €'
|
'amount' => number_format($amount->a / 100, 2, ',', '.').' €',
|
||||||
],
|
],
|
||||||
'groups' => Member::select('subactivities.slug', 'subactivities.name')->selectRaw('COUNT(members.id) AS count')->join('memberships', 'memberships.member_id', 'members.id')
|
'groups' => Member::select('subactivities.slug', 'subactivities.name')->selectRaw('COUNT(members.id) AS count')->join('memberships', 'memberships.member_id', 'members.id')
|
||||||
->join('activities', 'memberships.activity_id', 'activities.id')
|
->join('activities', 'memberships.activity_id', 'activities.id')
|
||||||
|
@ -33,8 +30,7 @@ class HomeView {
|
||||||
->orderBy('subactivities.id')
|
->orderBy('subactivities.id')
|
||||||
->get(),
|
->get(),
|
||||||
'ending_tries' => MemberTriesResource::collection(Member::endingTries()->get()),
|
'ending_tries' => MemberTriesResource::collection(Member::endingTries()->get()),
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace App\Http\Views;
|
namespace App\Http\Views;
|
||||||
|
|
||||||
use App\Member\MemberResource;
|
use App\Member\MemberResource;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @mixin \App\Member\Member
|
* @mixin \App\Member\Member
|
||||||
|
@ -13,7 +12,8 @@ class MemberTriesResource extends MemberResource
|
||||||
/**
|
/**
|
||||||
* Transform the resource into an array.
|
* Transform the resource into an array.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function toArray($request)
|
public function toArray($request)
|
||||||
|
|
|
@ -14,7 +14,8 @@ use App\Payment\Subscription;
|
||||||
use App\Subactivity;
|
use App\Subactivity;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class MemberView {
|
class MemberView
|
||||||
|
{
|
||||||
public function index(Request $request, array $filter): array
|
public function index(Request $request, array $filter): array
|
||||||
{
|
{
|
||||||
$activities = Activity::with('subactivities')->get();
|
$activities = Activity::with('subactivities')->get();
|
||||||
|
@ -29,13 +30,13 @@ class MemberView {
|
||||||
),
|
),
|
||||||
'filterActivities' => Activity::where('is_filterable', true)->pluck('name', 'id'),
|
'filterActivities' => Activity::where('is_filterable', true)->pluck('name', 'id'),
|
||||||
'filterSubactivities' => Subactivity::where('is_filterable', true)->pluck('name', 'id'),
|
'filterSubactivities' => Subactivity::where('is_filterable', true)->pluck('name', 'id'),
|
||||||
'toolbar' => [ ['href' => route('member.index'), 'label' => 'Zurück', 'color' => 'primary', 'icon' => 'plus'] ],
|
'toolbar' => [['href' => route('member.index'), 'label' => 'Zurück', 'color' => 'primary', 'icon' => 'plus']],
|
||||||
'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'),
|
||||||
'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) {
|
||||||
return ['subactivities' => $activity->subactivities->pluck('name', 'id'), 'id' => $activity->id];
|
return ['subactivities' => $activity->subactivities->pluck('name', 'id'), 'id' => $activity->id];
|
||||||
})->pluck('subactivities', 'id'),
|
})->pluck('subactivities', 'id'),
|
||||||
];
|
];
|
||||||
|
@ -45,7 +46,7 @@ class MemberView {
|
||||||
{
|
{
|
||||||
return $this->additional($member, [
|
return $this->additional($member, [
|
||||||
'model' => new PaymentResource($payment),
|
'model' => new PaymentResource($payment),
|
||||||
'links' => [ ['label' => 'Zurück', 'href' => route('member.payment.index', ['member' => $member]) ] ],
|
'links' => [['label' => 'Zurück', 'href' => route('member.payment.index', ['member' => $member])]],
|
||||||
'mode' => 'edit',
|
'mode' => 'edit',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +56,7 @@ class MemberView {
|
||||||
return $this->additional($member, [
|
return $this->additional($member, [
|
||||||
'model' => null,
|
'model' => null,
|
||||||
'links' => [
|
'links' => [
|
||||||
['icon' => 'plus', 'href' => route('member.payment.create', ['member' => $member]) ],
|
['icon' => 'plus', 'href' => route('member.payment.create', ['member' => $member])],
|
||||||
],
|
],
|
||||||
'payment_links' => app(ActionFactory::class)->forMember($member),
|
'payment_links' => app(ActionFactory::class)->forMember($member),
|
||||||
'mode' => 'index',
|
'mode' => 'index',
|
||||||
|
@ -70,5 +71,4 @@ class MemberView {
|
||||||
'statuses' => Status::pluck('name', 'id'),
|
'statuses' => Status::pluck('name', 'id'),
|
||||||
], $overwrites));
|
], $overwrites));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,8 @@ namespace App\Initialize;
|
||||||
|
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
|
||||||
class ActivityCreator {
|
class ActivityCreator
|
||||||
|
{
|
||||||
private array $tries = [
|
private array $tries = [
|
||||||
'Schnuppermitgliedschaft',
|
'Schnuppermitgliedschaft',
|
||||||
];
|
];
|
||||||
|
@ -17,8 +17,8 @@ class ActivityCreator {
|
||||||
|
|
||||||
public function createFor(Api $api, int $groupId): void
|
public function createFor(Api $api, int $groupId): void
|
||||||
{
|
{
|
||||||
$api->activities($groupId)->each(function($activity) use ($api) {
|
$api->activities($groupId)->each(function ($activity) use ($api) {
|
||||||
$activity = \App\Activity::updateOrCreate(['nami_id' => $activity->id], [
|
$activity = \App\Activity::updateOrCreate(['nami_id' => $activity->id], [
|
||||||
'nami_id' => $activity->id,
|
'nami_id' => $activity->id,
|
||||||
'name' => $activity->name,
|
'name' => $activity->name,
|
||||||
'is_try' => in_array($activity->name, $this->tries),
|
'is_try' => in_array($activity->name, $this->tries),
|
||||||
|
@ -26,7 +26,7 @@ class ActivityCreator {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$groups = [];
|
$groups = [];
|
||||||
$api->subactivitiesOf($activity->nami_id)->each(function($group) use (&$groups) {
|
$api->subactivitiesOf($activity->nami_id)->each(function ($group) use (&$groups) {
|
||||||
$group = \App\Subactivity::updateOrCreate(['nami_id' => $group->id], [
|
$group = \App\Subactivity::updateOrCreate(['nami_id' => $group->id], [
|
||||||
'nami_id' => $group->id,
|
'nami_id' => $group->id,
|
||||||
'name' => $group->name,
|
'name' => $group->name,
|
||||||
|
@ -36,6 +36,4 @@ class ActivityCreator {
|
||||||
$activity->subactivities()->sync($groups);
|
$activity->subactivities()->sync($groups);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,12 @@ namespace App\Initialize;
|
||||||
|
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
|
||||||
class InitializeActivities {
|
class InitializeActivities
|
||||||
|
{
|
||||||
private Api $api;
|
private Api $api;
|
||||||
|
|
||||||
public function __construct(Api $api) {
|
public function __construct(Api $api)
|
||||||
|
{
|
||||||
$this->api = $api;
|
$this->api = $api;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,18 +5,19 @@ namespace App\Initialize;
|
||||||
use App\Confession;
|
use App\Confession;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
|
||||||
class InitializeConfessions {
|
class InitializeConfessions
|
||||||
|
{
|
||||||
private Api $api;
|
private Api $api;
|
||||||
public string $nullName = 'ohne Konfession';
|
public string $nullName = 'ohne Konfession';
|
||||||
|
|
||||||
public function __construct(Api $api) {
|
public function __construct(Api $api)
|
||||||
|
{
|
||||||
$this->api = $api;
|
$this->api = $api;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$this->api->confessions()->each(function($confession) {
|
$this->api->confessions()->each(function ($confession) {
|
||||||
Confession::create(['nami_id' => $confession->id, 'name' => $confession->name, 'is_null' => $this->nullName === $confession->name]);
|
Confession::create(['nami_id' => $confession->id, 'name' => $confession->name, 'is_null' => $this->nullName === $confession->name]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ namespace App\Initialize;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Inertia\Response;
|
use Inertia\Response;
|
||||||
|
|
||||||
class InitializeController extends Controller
|
class InitializeController extends Controller
|
||||||
|
|
|
@ -4,17 +4,18 @@ namespace App\Initialize;
|
||||||
|
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
|
||||||
class InitializeCountries {
|
class InitializeCountries
|
||||||
|
{
|
||||||
private Api $api;
|
private Api $api;
|
||||||
|
|
||||||
public function __construct(Api $api) {
|
public function __construct(Api $api)
|
||||||
|
{
|
||||||
$this->api = $api;
|
$this->api = $api;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$this->api->countries()->each(function($country) {
|
$this->api->countries()->each(function ($country) {
|
||||||
\App\Country::create(['nami_id' => $country->id, 'name' => $country->name]);
|
\App\Country::create(['nami_id' => $country->id, 'name' => $country->name]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,17 +5,18 @@ namespace App\Initialize;
|
||||||
use App\Course\Models\Course;
|
use App\Course\Models\Course;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
|
||||||
class InitializeCourses {
|
class InitializeCourses
|
||||||
|
{
|
||||||
private Api $api;
|
private Api $api;
|
||||||
|
|
||||||
public function __construct(Api $api) {
|
public function __construct(Api $api)
|
||||||
|
{
|
||||||
$this->api = $api;
|
$this->api = $api;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$this->api->courses()->each(function($course) {
|
$this->api->courses()->each(function ($course) {
|
||||||
Course::create(['nami_id' => $course->id, 'name' => $course->name]);
|
Course::create(['nami_id' => $course->id, 'name' => $course->name]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,18 +5,19 @@ namespace App\Initialize;
|
||||||
use App\Fee;
|
use App\Fee;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
|
||||||
class InitializeFees {
|
class InitializeFees
|
||||||
|
{
|
||||||
private Api $api;
|
private Api $api;
|
||||||
|
|
||||||
public function __construct(Api $api) {
|
public function __construct(Api $api)
|
||||||
|
{
|
||||||
$this->api = $api;
|
$this->api = $api;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$group = $this->api->groups()->first()->id;
|
$group = $this->api->groups()->first()->id;
|
||||||
$this->api->feesOf($group)->each(function($fee) {
|
$this->api->feesOf($group)->each(function ($fee) {
|
||||||
Fee::create(['nami_id' => $fee->id, 'name' => $fee->name])
|
Fee::create(['nami_id' => $fee->id, 'name' => $fee->name])
|
||||||
->subscriptions()->create([
|
->subscriptions()->create([
|
||||||
'name' => $fee->name,
|
'name' => $fee->name,
|
||||||
|
|
|
@ -4,17 +4,18 @@ namespace App\Initialize;
|
||||||
|
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
|
||||||
class InitializeGenders {
|
class InitializeGenders
|
||||||
|
{
|
||||||
private Api $api;
|
private Api $api;
|
||||||
|
|
||||||
public function __construct(Api $api) {
|
public function __construct(Api $api)
|
||||||
|
{
|
||||||
$this->api = $api;
|
$this->api = $api;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$this->api->genders()->each(function($gender) {
|
$this->api->genders()->each(function ($gender) {
|
||||||
\App\Gender::create(['nami_id' => $gender->id, 'name' => $gender->name]);
|
\App\Gender::create(['nami_id' => $gender->id, 'name' => $gender->name]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,17 +5,18 @@ namespace App\Initialize;
|
||||||
use App\Group;
|
use App\Group;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
|
||||||
class InitializeGroups {
|
class InitializeGroups
|
||||||
|
{
|
||||||
private Api $api;
|
private Api $api;
|
||||||
|
|
||||||
public function __construct(Api $api) {
|
public function __construct(Api $api)
|
||||||
|
{
|
||||||
$this->api = $api;
|
$this->api = $api;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$this->api->groups()->each(function($group) {
|
$this->api->groups()->each(function ($group) {
|
||||||
$parent = Group::updateOrCreate(['nami_id' => $group->id], ['nami_id' => $group->id, 'name' => $group->name]);
|
$parent = Group::updateOrCreate(['nami_id' => $group->id], ['nami_id' => $group->id, 'name' => $group->name]);
|
||||||
|
|
||||||
$this->api->subgroupsOf($group->id)->each(function ($subgroup) use ($parent) {
|
$this->api->subgroupsOf($group->id)->each(function ($subgroup) use ($parent) {
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace App\Initialize;
|
namespace App\Initialize;
|
||||||
|
|
||||||
use App\Member;
|
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
|
@ -11,7 +10,10 @@ use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class InitializeJob implements ShouldQueue
|
class InitializeJob implements ShouldQueue
|
||||||
{
|
{
|
||||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
use Dispatchable;
|
||||||
|
use InteractsWithQueue;
|
||||||
|
use Queueable;
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the job.
|
* Execute the job.
|
||||||
|
|
|
@ -13,20 +13,19 @@ use App\Member\Member;
|
||||||
use App\Nationality;
|
use App\Nationality;
|
||||||
use App\Region;
|
use App\Region;
|
||||||
use App\Subactivity;
|
use App\Subactivity;
|
||||||
use Carbon\Carbon;
|
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
use Zoomyboy\LaravelNami\Data\MembershipEntry;
|
use Zoomyboy\LaravelNami\Data\MembershipEntry;
|
||||||
use Zoomyboy\LaravelNami\Exceptions\RightException;
|
use Zoomyboy\LaravelNami\Exceptions\RightException;
|
||||||
use Zoomyboy\LaravelNami\Member as NamiMember;
|
use Zoomyboy\LaravelNami\Member as NamiMember;
|
||||||
use Zoomyboy\LaravelNami\Membership as NamiMembership;
|
|
||||||
use Zoomyboy\LaravelNami\NamiException;
|
use Zoomyboy\LaravelNami\NamiException;
|
||||||
|
|
||||||
class InitializeMembers {
|
class InitializeMembers
|
||||||
|
{
|
||||||
private Api $api;
|
private Api $api;
|
||||||
|
|
||||||
public function __construct(Api $api) {
|
public function __construct(Api $api)
|
||||||
|
{
|
||||||
$this->api = $api;
|
$this->api = $api;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +43,7 @@ class InitializeMembers {
|
||||||
{
|
{
|
||||||
$allMembers = collect([]);
|
$allMembers = collect([]);
|
||||||
|
|
||||||
$this->api->search([])->each(function(NamiMember $member): void {
|
$this->api->search([])->each(function (NamiMember $member): void {
|
||||||
$member = NamiMember::fromNami($this->api->member($member->group_id, $member->id));
|
$member = NamiMember::fromNami($this->api->member($member->group_id, $member->id));
|
||||||
if (!$member->joined_at) {
|
if (!$member->joined_at) {
|
||||||
return;
|
return;
|
||||||
|
@ -90,12 +89,11 @@ class InitializeMembers {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
} catch (RightException $e) {
|
} catch (RightException $e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
foreach ($this->api->membershipsOf($member->id) as $membership) {
|
foreach ($this->api->membershipsOf($member->id) as $membership) {
|
||||||
if ($membership->endsAt !== null) {
|
if (null !== $membership->endsAt) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -115,7 +113,6 @@ class InitializeMembers {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
} catch (RightException $e) {
|
} catch (RightException $e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (ModelNotFoundException $e) {
|
} catch (ModelNotFoundException $e) {
|
||||||
dd($e->getMessage(), $member);
|
dd($e->getMessage(), $member);
|
||||||
|
@ -137,13 +134,14 @@ class InitializeMembers {
|
||||||
$subactivityId = $membership->subactivityId
|
$subactivityId = $membership->subactivityId
|
||||||
? Subactivity::where('nami_id', $membership->subactivityId)->firstOrFail()->id
|
? Subactivity::where('nami_id', $membership->subactivityId)->firstOrFail()->id
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
return [$activityId, $subactivityId, $group->id];
|
return [$activityId, $subactivityId, $group->id];
|
||||||
} catch (ModelNotFoundException $e) {
|
} catch (ModelNotFoundException $e) {
|
||||||
return [null, null, null];
|
return [null, null, null];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($membershipEntry->subactivity === null) {
|
if (null === $membershipEntry->subactivity) {
|
||||||
$subactivityId = null;
|
$subactivityId = null;
|
||||||
} else {
|
} else {
|
||||||
$subactivityId = Subactivity::where('name', $membershipEntry->subactivity)->firstOrFail()->id;
|
$subactivityId = Subactivity::where('name', $membershipEntry->subactivity)->firstOrFail()->id;
|
||||||
|
@ -160,7 +158,7 @@ class InitializeMembers {
|
||||||
if (!Group::where('name', $membershipEntry->group)->exists()) {
|
if (!Group::where('name', $membershipEntry->group)->exists()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (preg_match('/\(([0-9]+)\)/', $membershipEntry->activity, $activityMatches) !== 1) {
|
if (1 !== preg_match('/\(([0-9]+)\)/', $membershipEntry->activity, $activityMatches)) {
|
||||||
throw new NamiException("ID in taetigkeit string not found: {$membershipEntry->activity}");
|
throw new NamiException("ID in taetigkeit string not found: {$membershipEntry->activity}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +166,7 @@ class InitializeMembers {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($membershipEntry->subactivity === null) {
|
if (null === $membershipEntry->subactivity) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,17 +5,18 @@ namespace App\Initialize;
|
||||||
use App\Nationality;
|
use App\Nationality;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
|
||||||
class InitializeNationalities {
|
class InitializeNationalities
|
||||||
|
{
|
||||||
private Api $api;
|
private Api $api;
|
||||||
|
|
||||||
public function __construct(Api $api) {
|
public function __construct(Api $api)
|
||||||
|
{
|
||||||
$this->api = $api;
|
$this->api = $api;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(Api $api): void
|
public function handle(Api $api): void
|
||||||
{
|
{
|
||||||
$this->api->nationalities()->each(function($nationality) {
|
$this->api->nationalities()->each(function ($nationality) {
|
||||||
Nationality::create(['nami_id' => $nationality->id, 'name' => $nationality->name]);
|
Nationality::create(['nami_id' => $nationality->id, 'name' => $nationality->name]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,18 +4,19 @@ namespace App\Initialize;
|
||||||
|
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
|
||||||
class InitializeRegions {
|
class InitializeRegions
|
||||||
|
{
|
||||||
private Api $api;
|
private Api $api;
|
||||||
private string $nullName = 'Nicht-DE';
|
private string $nullName = 'Nicht-DE';
|
||||||
|
|
||||||
public function __construct(Api $api) {
|
public function __construct(Api $api)
|
||||||
|
{
|
||||||
$this->api = $api;
|
$this->api = $api;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$this->api->regions()->each(function($region) {
|
$this->api->regions()->each(function ($region) {
|
||||||
\App\Region::create(['nami_id' => $region->id, 'name' => $region->name, 'is_null' => $region->name == $this->nullName]);
|
\App\Region::create(['nami_id' => $region->id, 'name' => $region->name, 'is_null' => $region->name == $this->nullName]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,9 @@
|
||||||
namespace App\Initialize;
|
namespace App\Initialize;
|
||||||
|
|
||||||
use App\Setting\NamiSettings;
|
use App\Setting\NamiSettings;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
|
||||||
|
|
||||||
class Initializer {
|
|
||||||
|
|
||||||
|
class Initializer
|
||||||
|
{
|
||||||
public NamiSettings $settings;
|
public NamiSettings $settings;
|
||||||
public array $initializers = [
|
public array $initializers = [
|
||||||
InitializeNationalities::class,
|
InitializeNationalities::class,
|
||||||
|
@ -25,10 +24,10 @@ class Initializer {
|
||||||
$this->settings = $settings;
|
$this->settings = $settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run(): void {
|
public function run(): void
|
||||||
|
{
|
||||||
foreach ($this->initializers as $initializer) {
|
foreach ($this->initializers as $initializer) {
|
||||||
app($initializer)->handle($this->settings->login());
|
app($initializer)->handle($this->settings->login());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,10 @@ use Zoomyboy\LaravelNami\Nami;
|
||||||
|
|
||||||
class CreateJob implements ShouldQueue
|
class CreateJob implements ShouldQueue
|
||||||
{
|
{
|
||||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
use Dispatchable;
|
||||||
|
use InteractsWithQueue;
|
||||||
|
use Queueable;
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
public int $memberId;
|
public int $memberId;
|
||||||
public Member $member;
|
public Member $member;
|
||||||
|
@ -67,7 +70,7 @@ class CreateJob implements ShouldQueue
|
||||||
'first_activity_id' => $this->member->firstActivity->nami_id,
|
'first_activity_id' => $this->member->firstActivity->nami_id,
|
||||||
'first_subactivity_id' => $this->member->firstSubactivity->nami_id,
|
'first_subactivity_id' => $this->member->firstSubactivity->nami_id,
|
||||||
]);
|
]);
|
||||||
Member::withoutEvents(function() use ($response) {
|
Member::withoutEvents(function () use ($response) {
|
||||||
$version = Nami::login($this->user->mglnr)->member($this->member->group->nami_id, $response['id'])['version'];
|
$version = Nami::login($this->user->mglnr)->member($this->member->group->nami_id, $response['id'])['version'];
|
||||||
$this->member->update(['version' => $version, 'nami_id' => $response['id']]);
|
$this->member->update(['version' => $version, 'nami_id' => $response['id']]);
|
||||||
});
|
});
|
||||||
|
@ -84,6 +87,5 @@ class CreateJob implements ShouldQueue
|
||||||
'created_at' => $membership['starts_at'],
|
'created_at' => $membership['starts_at'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,17 +2,18 @@
|
||||||
|
|
||||||
namespace App\Member;
|
namespace App\Member;
|
||||||
|
|
||||||
use App\Confession;
|
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Zoomyboy\LaravelNami\Nami;
|
|
||||||
|
|
||||||
class DeleteJob implements ShouldQueue
|
class DeleteJob implements ShouldQueue
|
||||||
{
|
{
|
||||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
use Dispatchable;
|
||||||
|
use InteractsWithQueue;
|
||||||
|
use Queueable;
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
public int $memberId;
|
public int $memberId;
|
||||||
public Member $member;
|
public Member $member;
|
||||||
|
@ -38,7 +39,7 @@ class DeleteJob implements ShouldQueue
|
||||||
|
|
||||||
$setting->login()->deleteMember($this->member->nami_id);
|
$setting->login()->deleteMember($this->member->nami_id);
|
||||||
|
|
||||||
Member::withoutEvents(function() {
|
Member::withoutEvents(function () {
|
||||||
$this->member->update(['nami_id' => null]);
|
$this->member->update(['nami_id' => null]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,16 +18,15 @@ use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property string $subscription_name
|
* @property string $subscription_name
|
||||||
* @property int $pending_payment
|
* @property int $pending_payment
|
||||||
* @property bool $is_confirmed
|
* @property bool $is_confirmed
|
||||||
* @property string $age_group_icon
|
* @property string $age_group_icon
|
||||||
* @property \Carbon\Carbon $try_created_at
|
* @property \Carbon\Carbon $try_created_at
|
||||||
*/
|
*/
|
||||||
class Member extends Model
|
class Member extends Model
|
||||||
|
@ -51,8 +50,12 @@ class Member extends Model
|
||||||
'is_confirmed' => 'boolean',
|
'is_confirmed' => 'boolean',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function scopeSearch(Builder $q, ?string $text): Builder {
|
public function scopeSearch(Builder $q, ?string $text): Builder
|
||||||
if (is_null($text)) { return $q; }
|
{
|
||||||
|
if (is_null($text)) {
|
||||||
|
return $q;
|
||||||
|
}
|
||||||
|
|
||||||
return $q->where('firstname', 'LIKE', '%'.$text.'%')
|
return $q->where('firstname', 'LIKE', '%'.$text.'%')
|
||||||
->orWhere('lastname', 'LIKE', '%'.$text.'%')
|
->orWhere('lastname', 'LIKE', '%'.$text.'%')
|
||||||
->orWhere('address', 'LIKE', '%'.$text.'%')
|
->orWhere('address', 'LIKE', '%'.$text.'%')
|
||||||
|
@ -76,19 +79,23 @@ class Member extends Model
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------- Getters -----------------------------------
|
//----------------------------------- Getters -----------------------------------
|
||||||
public function getFullnameAttribute(): string {
|
public function getFullnameAttribute(): string
|
||||||
|
{
|
||||||
return $this->firstname.' '.$this->lastname;
|
return $this->firstname.' '.$this->lastname;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHasNamiAttribute(): bool {
|
public function getHasNamiAttribute(): bool
|
||||||
return $this->nami_id !== null;
|
{
|
||||||
|
return null !== $this->nami_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNamiMemberships(Api $api): array {
|
public function getNamiMemberships(Api $api): array
|
||||||
|
{
|
||||||
return $api->group($this->group->nami_id)->member($this->nami_id)->memberships()->toArray();
|
return $api->group($this->group->nami_id)->member($this->nami_id)->memberships()->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNamiFeeId(): ?int {
|
public function getNamiFeeId(): ?int
|
||||||
|
{
|
||||||
if (!$this->subscription) {
|
if (!$this->subscription) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -164,70 +171,79 @@ class Member extends Model
|
||||||
|
|
||||||
public static function booted()
|
public static function booted()
|
||||||
{
|
{
|
||||||
static::deleting(function(self $model): void {
|
static::deleting(function (self $model): void {
|
||||||
$model->payments->each->delete();
|
$model->payments->each->delete();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------- Scopes -----------------------------------
|
// ---------------------------------- Scopes -----------------------------------
|
||||||
public function scopeWithIsConfirmed(Builder $q): Builder {
|
public function scopeWithIsConfirmed(Builder $q): Builder
|
||||||
|
{
|
||||||
return $q->selectSub('DATEDIFF(NOW(), IFNULL(confirmed_at, DATE_SUB(NOW(), INTERVAL 3 YEAR))) < 712', 'is_confirmed');
|
return $q->selectSub('DATEDIFF(NOW(), IFNULL(confirmed_at, DATE_SUB(NOW(), INTERVAL 3 YEAR))) < 712', 'is_confirmed');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeWithSubscriptionName(Builder $q): Builder {
|
public function scopeWithSubscriptionName(Builder $q): Builder
|
||||||
|
{
|
||||||
return $q->addSelect([
|
return $q->addSelect([
|
||||||
'subscription_name' => Subscription::select('name')->whereColumn('subscriptions.id', 'members.subscription_id')->limit(1)
|
'subscription_name' => Subscription::select('name')->whereColumn('subscriptions.id', 'members.subscription_id')->limit(1),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeWithPendingPayment(Builder $q): Builder {
|
public function scopeWithPendingPayment(Builder $q): Builder
|
||||||
|
{
|
||||||
return $q->addSelect([
|
return $q->addSelect([
|
||||||
'pending_payment' => Payment::selectRaw('SUM(subscriptions.amount)')
|
'pending_payment' => Payment::selectRaw('SUM(subscriptions.amount)')
|
||||||
->whereColumn('payments.member_id', 'members.id')
|
->whereColumn('payments.member_id', 'members.id')
|
||||||
->whereNeedsPayment()
|
->whereNeedsPayment()
|
||||||
->join('subscriptions', 'subscriptions.id', 'payments.subscription_id')
|
->join('subscriptions', 'subscriptions.id', 'payments.subscription_id'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeWithAgeGroup(Builder $q): Builder {
|
public function scopeWithAgeGroup(Builder $q): Builder
|
||||||
|
{
|
||||||
return $q->addSelect([
|
return $q->addSelect([
|
||||||
'age_group_icon' => Subactivity::select('slug')
|
'age_group_icon' => Subactivity::select('slug')
|
||||||
->join('memberships', 'memberships.subactivity_id', 'subactivities.id')
|
->join('memberships', 'memberships.subactivity_id', 'subactivities.id')
|
||||||
->where('subactivities.is_age_group', true)
|
->where('subactivities.is_age_group', true)
|
||||||
->whereColumn('memberships.member_id', 'members.id')
|
->whereColumn('memberships.member_id', 'members.id')
|
||||||
->limit(1)
|
->limit(1),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeWhereHasPendingPayment(Builder $q): Builder {
|
public function scopeWhereHasPendingPayment(Builder $q): Builder
|
||||||
return $q->whereHas('payments', function(Builder $q): void {
|
{
|
||||||
|
return $q->whereHas('payments', function (Builder $q): void {
|
||||||
$q->whereNeedsPayment();
|
$q->whereNeedsPayment();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeWhereAusstand(Builder $q): Builder {
|
public function scopeWhereAusstand(Builder $q): Builder
|
||||||
return $q->whereHas('payments', function($q) {
|
{
|
||||||
|
return $q->whereHas('payments', function ($q) {
|
||||||
return $q->whereHas('status', fn ($q) => $q->where('is_remember', true));
|
return $q->whereHas('status', fn ($q) => $q->where('is_remember', true));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopePayable(Builder $q): Builder {
|
public function scopePayable(Builder $q): Builder
|
||||||
|
{
|
||||||
return $q->where('bill_kind_id', '!=', null)->where('subscription_id', '!=', null);
|
return $q->where('bill_kind_id', '!=', null)->where('subscription_id', '!=', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeWhereNoPayment(Builder $q, int $year): Builder {
|
public function scopeWhereNoPayment(Builder $q, int $year): Builder
|
||||||
return $q->whereDoesntHave('payments', function(Builder $q) use ($year) {
|
{
|
||||||
|
return $q->whereDoesntHave('payments', function (Builder $q) use ($year) {
|
||||||
$q->where('nr', '=', $year);
|
$q->where('nr', '=', $year);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeForDashboard(Builder $q): Builder {
|
public function scopeForDashboard(Builder $q): Builder
|
||||||
|
{
|
||||||
return $q->selectRaw('SUM(id)');
|
return $q->selectRaw('SUM(id)');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeFilter(Builder $q, array $filter): Builder
|
public function scopeFilter(Builder $q, array $filter): Builder
|
||||||
{
|
{
|
||||||
if (data_get($filter, 'ausstand', false) === true) {
|
if (true === data_get($filter, 'ausstand', false)) {
|
||||||
$q->whereAusstand();
|
$q->whereAusstand();
|
||||||
}
|
}
|
||||||
if (data_get($filter, 'bill_kind', false)) {
|
if (data_get($filter, 'bill_kind', false)) {
|
||||||
|
@ -256,8 +272,7 @@ class Member extends Model
|
||||||
'try_created_at' => Membership::select('created_at')
|
'try_created_at' => Membership::select('created_at')
|
||||||
->whereColumn('memberships.member_id', 'members.id')
|
->whereColumn('memberships.member_id', 'members.id')
|
||||||
->join('activities', 'activities.id', 'memberships.activity_id')
|
->join('activities', 'activities.id', 'memberships.activity_id')
|
||||||
->where('activities.is_try', true)
|
->where('activities.is_try', true),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,8 @@ use App\Bill\BillKind;
|
||||||
use App\Confession;
|
use App\Confession;
|
||||||
use App\Country;
|
use App\Country;
|
||||||
use App\Gender;
|
use App\Gender;
|
||||||
use App\Group;
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Views\MemberView;
|
use App\Http\Views\MemberView;
|
||||||
use App\Member\DeleteJob;
|
|
||||||
use App\Nationality;
|
use App\Nationality;
|
||||||
use App\Payment\Subscription;
|
use App\Payment\Subscription;
|
||||||
use App\Region;
|
use App\Region;
|
||||||
|
@ -21,7 +19,6 @@ use Inertia\Response;
|
||||||
|
|
||||||
class MemberController extends Controller
|
class MemberController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
public array $filter = [
|
public array $filter = [
|
||||||
'ausstand' => false,
|
'ausstand' => false,
|
||||||
'bill_kind' => null,
|
'bill_kind' => null,
|
||||||
|
@ -29,7 +26,8 @@ class MemberController extends Controller
|
||||||
'subactivity_id' => null,
|
'subactivity_id' => null,
|
||||||
];
|
];
|
||||||
|
|
||||||
public function index(Request $request, GeneralSettings $settings): Response {
|
public function index(Request $request, GeneralSettings $settings): Response
|
||||||
|
{
|
||||||
session()->put('menu', 'member');
|
session()->put('menu', 'member');
|
||||||
session()->put('title', 'Mitglieder');
|
session()->put('title', 'Mitglieder');
|
||||||
|
|
||||||
|
@ -61,7 +59,7 @@ class MemberController extends Controller
|
||||||
|
|
||||||
return \Inertia::render('member/VForm', [
|
return \Inertia::render('member/VForm', [
|
||||||
'activities' => $activities->pluck('name', 'id'),
|
'activities' => $activities->pluck('name', 'id'),
|
||||||
'subactivities' => $activities->map(function(Activity $activity) {
|
'subactivities' => $activities->map(function (Activity $activity) {
|
||||||
return ['subactivities' => $activity->subactivities()->pluck('name', 'id'), 'id' => $activity->id];
|
return ['subactivities' => $activity->subactivities()->pluck('name', 'id'), 'id' => $activity->id];
|
||||||
})->pluck('subactivities', 'id'),
|
})->pluck('subactivities', 'id'),
|
||||||
'billKinds' => BillKind::pluck('name', 'id'),
|
'billKinds' => BillKind::pluck('name', 'id'),
|
||||||
|
@ -72,7 +70,7 @@ class MemberController extends Controller
|
||||||
'confessions' => Confession::where('is_null', false)->pluck('name', 'id'),
|
'confessions' => Confession::where('is_null', false)->pluck('name', 'id'),
|
||||||
'subscriptions' => Subscription::pluck('name', 'id'),
|
'subscriptions' => Subscription::pluck('name', 'id'),
|
||||||
'data' => [
|
'data' => [
|
||||||
'country_id' => Country::default()
|
'country_id' => Country::default(),
|
||||||
],
|
],
|
||||||
'mode' => 'create',
|
'mode' => 'create',
|
||||||
]);
|
]);
|
||||||
|
@ -94,7 +92,7 @@ class MemberController extends Controller
|
||||||
|
|
||||||
return \Inertia::render('member/VForm', [
|
return \Inertia::render('member/VForm', [
|
||||||
'activities' => $activities->pluck('name', 'id'),
|
'activities' => $activities->pluck('name', 'id'),
|
||||||
'subactivities' => $activities->map(function($activity) {
|
'subactivities' => $activities->map(function ($activity) {
|
||||||
return ['subactivities' => $activity->subactivities->pluck('name', 'id'), 'id' => $activity->id];
|
return ['subactivities' => $activity->subactivities->pluck('name', 'id'), 'id' => $activity->id];
|
||||||
})->pluck('subactivities', 'id'),
|
})->pluck('subactivities', 'id'),
|
||||||
'billKinds' => BillKind::pluck('name', 'id'),
|
'billKinds' => BillKind::pluck('name', 'id'),
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace App\Member;
|
||||||
use App\Activity;
|
use App\Activity;
|
||||||
use App\Group;
|
use App\Group;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Support\Arr;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
@ -30,14 +29,16 @@ class MemberRequest extends FormRequest
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'first_activity_id' => Rule::requiredIf(fn() => $this->method() == 'POST'),
|
'first_activity_id' => Rule::requiredIf(fn () => 'POST' == $this->method()),
|
||||||
'first_subactivity_id' => Rule::requiredIf(fn() => $this->method() == 'POST'),
|
'first_subactivity_id' => Rule::requiredIf(fn () => 'POST' == $this->method()),
|
||||||
'subscription_id' => Rule::requiredIf(function() {
|
'subscription_id' => Rule::requiredIf(function () {
|
||||||
if ($this->method() != 'POST') {
|
if ('POST' != $this->method()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->input('first_activity_id')) { return true; }
|
if (!$this->input('first_activity_id')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return Str::contains(Activity::findOrFail($this->input('first_activity_id'))->name, '€');
|
return Str::contains(Activity::findOrFail($this->input('first_activity_id'))->name, '€');
|
||||||
}),
|
}),
|
||||||
|
@ -58,10 +59,11 @@ class MemberRequest extends FormRequest
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function persistCreate(): void {
|
public function persistCreate(): void
|
||||||
|
{
|
||||||
$this->merge(['group_id' => Group::where('nami_id', Auth::user()->getNamiGroupId())->firstOrFail()->id]);
|
$this->merge(['group_id' => Group::where('nami_id', Auth::user()->getNamiGroupId())->firstOrFail()->id]);
|
||||||
$member = Member::create($this->input());
|
$member = Member::create($this->input());
|
||||||
if($this->input('has_nami')) {
|
if ($this->input('has_nami')) {
|
||||||
CreateJob::dispatch($member, auth()->user());
|
CreateJob::dispatch($member, auth()->user());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,13 +72,13 @@ class MemberRequest extends FormRequest
|
||||||
{
|
{
|
||||||
$member->update($this->input());
|
$member->update($this->input());
|
||||||
|
|
||||||
if($this->input('has_nami') && $member->nami_id === null) {
|
if ($this->input('has_nami') && null === $member->nami_id) {
|
||||||
CreateJob::dispatch($member, auth()->user());
|
CreateJob::dispatch($member, auth()->user());
|
||||||
}
|
}
|
||||||
if($this->input('has_nami') && $member->nami_id !== null) {
|
if ($this->input('has_nami') && null !== $member->nami_id) {
|
||||||
UpdateJob::dispatch($member, auth()->user());
|
UpdateJob::dispatch($member, auth()->user());
|
||||||
}
|
}
|
||||||
if(!$this->input('has_nami') && $member->nami_id !== null) {
|
if (!$this->input('has_nami') && null !== $member->nami_id) {
|
||||||
DeleteJob::dispatch($member, auth()->user());
|
DeleteJob::dispatch($member, auth()->user());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,8 @@ class MemberResource extends JsonResource
|
||||||
/**
|
/**
|
||||||
* Transform the resource into an array.
|
* Transform the resource into an array.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function toArray($request)
|
public function toArray($request)
|
||||||
|
@ -50,7 +51,7 @@ class MemberResource extends JsonResource
|
||||||
'letter_address' => $this->letter_address,
|
'letter_address' => $this->letter_address,
|
||||||
'bill_kind_id' => $this->bill_kind_id,
|
'bill_kind_id' => $this->bill_kind_id,
|
||||||
'bill_kind_name' => optional($this->billKind)->name,
|
'bill_kind_name' => optional($this->billKind)->name,
|
||||||
'has_nami' => $this->nami_id !== null,
|
'has_nami' => null !== $this->nami_id,
|
||||||
'is_confirmed' => $this->is_confirmed,
|
'is_confirmed' => $this->is_confirmed,
|
||||||
'children_phone' => $this->children_phone,
|
'children_phone' => $this->children_phone,
|
||||||
'payments' => PaymentResource::collection($this->whenLoaded('payments')),
|
'payments' => PaymentResource::collection($this->whenLoaded('payments')),
|
||||||
|
|
|
@ -23,5 +23,4 @@ class Membership extends Model
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Subactivity::class);
|
return $this->belongsTo(Subactivity::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,17 +4,18 @@ namespace App\Member;
|
||||||
|
|
||||||
use App\Confession;
|
use App\Confession;
|
||||||
use App\Setting\NamiSettings;
|
use App\Setting\NamiSettings;
|
||||||
use App\User;
|
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Zoomyboy\LaravelNami\Nami;
|
|
||||||
|
|
||||||
class UpdateJob implements ShouldQueue
|
class UpdateJob implements ShouldQueue
|
||||||
{
|
{
|
||||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
use Dispatchable;
|
||||||
|
use InteractsWithQueue;
|
||||||
|
use Queueable;
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
public int $memberId;
|
public int $memberId;
|
||||||
public Member $member;
|
public Member $member;
|
||||||
|
@ -65,7 +66,7 @@ class UpdateJob implements ShouldQueue
|
||||||
'group_id' => $this->member->group->nami_id,
|
'group_id' => $this->member->group->nami_id,
|
||||||
'version' => $this->member->version,
|
'version' => $this->member->version,
|
||||||
]);
|
]);
|
||||||
Member::withoutEvents(function() use ($response) {
|
Member::withoutEvents(function () use ($response) {
|
||||||
$this->member->update(['version' => $response['version']]);
|
$this->member->update(['version' => $response['version']]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,11 +8,9 @@ use App\Member\Membership;
|
||||||
use App\Membership\Requests\StoreRequest;
|
use App\Membership\Requests\StoreRequest;
|
||||||
use App\Setting\NamiSettings;
|
use App\Setting\NamiSettings;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
|
|
||||||
class MembershipController extends Controller
|
class MembershipController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
public function store(Member $member, StoreRequest $request, NamiSettings $settings): RedirectResponse
|
public function store(Member $member, StoreRequest $request, NamiSettings $settings): RedirectResponse
|
||||||
{
|
{
|
||||||
$request->persist($member, $settings);
|
$request->persist($member, $settings);
|
||||||
|
@ -30,5 +28,4 @@ class MembershipController extends Controller
|
||||||
|
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,8 @@ class MembershipResource extends JsonResource
|
||||||
/**
|
/**
|
||||||
* Transform the resource into an array.
|
* Transform the resource into an array.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function toArray($request)
|
public function toArray($request)
|
||||||
|
|
|
@ -11,7 +11,6 @@ use Zoomyboy\LaravelNami\Data\Membership;
|
||||||
|
|
||||||
class StoreRequest extends FormRequest
|
class StoreRequest extends FormRequest
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the user is authorized to make this request.
|
* Determine if the user is authorized to make this request.
|
||||||
*
|
*
|
||||||
|
@ -30,7 +29,6 @@ class StoreRequest extends FormRequest
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
//
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,5 +49,4 @@ class StoreRequest extends FormRequest
|
||||||
|
|
||||||
$member->syncVersion();
|
$member->syncVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ use Exception;
|
||||||
|
|
||||||
trait HasNamiField
|
trait HasNamiField
|
||||||
{
|
{
|
||||||
|
|
||||||
public static function nami(int $id): self
|
public static function nami(int $id): self
|
||||||
{
|
{
|
||||||
$model = static::firstWhere('nami_id', $id);
|
$model = static::firstWhere('nami_id', $id);
|
||||||
|
@ -17,5 +16,4 @@ trait HasNamiField
|
||||||
|
|
||||||
return $model;
|
return $model;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,5 +11,5 @@ class Nationality extends Model
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
use HasNamiField;
|
use HasNamiField;
|
||||||
|
|
||||||
public $fillable = ['name','nami_id'];
|
public $fillable = ['name', 'nami_id'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,9 @@ use Illuminate\Support\Collection;
|
||||||
|
|
||||||
class ActionFactory
|
class ActionFactory
|
||||||
{
|
{
|
||||||
|
|
||||||
public function forMember(Member $member): Collection
|
public function forMember(Member $member): Collection
|
||||||
{
|
{
|
||||||
return app(PdfRepositoryFactory::class)->getTypes()->map(function(PdfRepository $repo) use ($member): array {
|
return app(PdfRepositoryFactory::class)->getTypes()->map(function (PdfRepository $repo) use ($member): array {
|
||||||
return [
|
return [
|
||||||
'href' => route('member.singlepdf', ['member' => $member, 'type' => get_class($repo)]),
|
'href' => route('member.singlepdf', ['member' => $member, 'type' => get_class($repo)]),
|
||||||
'label' => $repo->linkLabel(),
|
'label' => $repo->linkLabel(),
|
||||||
|
@ -23,7 +22,7 @@ class ActionFactory
|
||||||
|
|
||||||
public function allLinks(): Collection
|
public function allLinks(): Collection
|
||||||
{
|
{
|
||||||
return app(PdfRepositoryFactory::class)->getTypes()->map(function(PdfRepository $repo) {
|
return app(PdfRepositoryFactory::class)->getTypes()->map(function (PdfRepository $repo) {
|
||||||
return [
|
return [
|
||||||
'link' => [
|
'link' => [
|
||||||
'href' => route('sendpayment.pdf', ['type' => get_class($repo)]),
|
'href' => route('sendpayment.pdf', ['type' => get_class($repo)]),
|
||||||
|
@ -33,5 +32,4 @@ class ActionFactory
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ namespace App\Payment;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Member\Member;
|
use App\Member\Member;
|
||||||
use App\Payment\Status;
|
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Inertia\Response;
|
use Inertia\Response;
|
||||||
|
@ -22,7 +21,7 @@ class AllpaymentController extends Controller
|
||||||
public function store(Request $request): RedirectResponse
|
public function store(Request $request): RedirectResponse
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'year' => 'required|numeric'
|
'year' => 'required|numeric',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
foreach (Member::payable()->whereNoPayment($request->year)->get() as $member) {
|
foreach (Member::payable()->whereNoPayment($request->year)->get() as $member) {
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
namespace App\Payment;
|
namespace App\Payment;
|
||||||
|
|
||||||
use App\Member\Member;
|
use App\Member\Member;
|
||||||
use App\Payment\Status;
|
|
||||||
use App\Payment\Subscription;
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
@ -33,21 +31,21 @@ class Payment extends Model
|
||||||
|
|
||||||
public function scopeWhereNeedsPayment(Builder $q): Builder
|
public function scopeWhereNeedsPayment(Builder $q): Builder
|
||||||
{
|
{
|
||||||
return $q->whereHas('status', function($q) {
|
return $q->whereHas('status', function ($q) {
|
||||||
return $q->needsPayment();
|
return $q->needsPayment();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeWhereNeedsBill(Builder $q): Builder
|
public function scopeWhereNeedsBill(Builder $q): Builder
|
||||||
{
|
{
|
||||||
return $q->whereHas('status', function($q) {
|
return $q->whereHas('status', function ($q) {
|
||||||
return $q->where('is_bill', true);
|
return $q->where('is_bill', true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeWhereNeedsRemember(Builder $q): Builder
|
public function scopeWhereNeedsRemember(Builder $q): Builder
|
||||||
{
|
{
|
||||||
return $q->whereHas('status', function($q) {
|
return $q->whereHas('status', function ($q) {
|
||||||
return $q->where('is_remember', true);
|
return $q->where('is_remember', true);
|
||||||
})->where(fn ($query) => $query->whereNull('last_remembered_at')->orWhere('last_remembered_at', '<=', now()->subMonths(3)));
|
})->where(fn ($query) => $query->whereNull('last_remembered_at')->orWhere('last_remembered_at', '<=', now()->subMonths(3)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace App\Payment;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Views\MemberView;
|
use App\Http\Views\MemberView;
|
||||||
use App\Member\Member;
|
use App\Member\Member;
|
||||||
use App\Member\MemberResource;
|
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Inertia\Response;
|
use Inertia\Response;
|
||||||
|
|
|
@ -4,14 +4,14 @@ namespace App\Payment;
|
||||||
|
|
||||||
use App\Pdf\PdfRepository;
|
use App\Pdf\PdfRepository;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Mail\Mailable;
|
use Illuminate\Mail\Mailable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class PaymentMail extends Mailable
|
class PaymentMail extends Mailable
|
||||||
{
|
{
|
||||||
use Queueable, SerializesModels;
|
use Queueable;
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
public PdfRepository $repo;
|
public PdfRepository $repo;
|
||||||
public string $filename;
|
public string $filename;
|
||||||
|
@ -35,6 +35,7 @@ class PaymentMail extends Mailable
|
||||||
public function build()
|
public function build()
|
||||||
{
|
{
|
||||||
$template = Str::snake(class_basename($this->repo));
|
$template = Str::snake(class_basename($this->repo));
|
||||||
|
|
||||||
return $this->markdown('mail.payment.'.$template)
|
return $this->markdown('mail.payment.'.$template)
|
||||||
->attach($this->filename)
|
->attach($this->filename)
|
||||||
->replyTo('kasse@stamm-silva.de')
|
->replyTo('kasse@stamm-silva.de')
|
||||||
|
|
|
@ -12,7 +12,8 @@ class PaymentResource extends JsonResource
|
||||||
/**
|
/**
|
||||||
* Transform the resource into an array.
|
* Transform the resource into an array.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function toArray($request)
|
public function toArray($request)
|
||||||
|
@ -27,5 +28,4 @@ class PaymentResource extends JsonResource
|
||||||
'is_accepted' => $this->status->isAccepted(),
|
'is_accepted' => $this->status->isAccepted(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,5 +77,4 @@ class PaymentSendCommand extends Command
|
||||||
app(PdfRepositoryFactory::class)->afterSingle($repo);
|
app(PdfRepositoryFactory::class)->afterSingle($repo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ namespace App\Payment;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Pdf\PdfGenerator;
|
use App\Pdf\PdfGenerator;
|
||||||
use App\Pdf\PdfRepository;
|
|
||||||
use App\Pdf\PdfRepositoryFactory;
|
use App\Pdf\PdfRepositoryFactory;
|
||||||
use Illuminate\Contracts\Support\Responsable;
|
use Illuminate\Contracts\Support\Responsable;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
@ -14,7 +13,6 @@ use Inertia\Response as InertiaResponse;
|
||||||
|
|
||||||
class SendpaymentController extends Controller
|
class SendpaymentController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
public function create(): InertiaResponse
|
public function create(): InertiaResponse
|
||||||
{
|
{
|
||||||
session()->put('menu', 'member');
|
session()->put('menu', 'member');
|
||||||
|
@ -35,9 +33,8 @@ class SendpaymentController extends Controller
|
||||||
$pdfFile = app(PdfGenerator::class)->setRepository($repo)->render();
|
$pdfFile = app(PdfGenerator::class)->setRepository($repo)->render();
|
||||||
app(PdfRepositoryFactory::class)->afterAll($request->type, 'Post');
|
app(PdfRepositoryFactory::class)->afterAll($request->type, 'Post');
|
||||||
|
|
||||||
return $repo === null
|
return null === $repo
|
||||||
? response()->noContent()
|
? response()->noContent()
|
||||||
: $pdfFile;
|
: $pdfFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ class Status extends Model
|
||||||
'is_remember' => 'boolean',
|
'is_remember' => 'boolean',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
public static function default(): int
|
public static function default(): int
|
||||||
{
|
{
|
||||||
return static::where('is_bill', true)->where('is_remember', true)->first()->id;
|
return static::where('is_bill', true)->where('is_remember', true)->first()->id;
|
||||||
|
@ -25,13 +24,13 @@ class Status extends Model
|
||||||
|
|
||||||
public function isAccepted(): bool
|
public function isAccepted(): bool
|
||||||
{
|
{
|
||||||
return $this->is_bill === false && $this->is_remember === false;
|
return false === $this->is_bill && false === $this->is_remember;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------- Scopes -----------------------------------
|
// ---------------------------------- Scopes -----------------------------------
|
||||||
public function scopeNeedsPayment(Builder $query): Builder
|
public function scopeNeedsPayment(Builder $query): Builder
|
||||||
{
|
{
|
||||||
return $query->where(function(Builder $query): Builder {
|
return $query->where(function (Builder $query): Builder {
|
||||||
return $query->where('is_bill', true)->orWhere('is_remember', true);
|
return $query->where('is_bill', true)->orWhere('is_remember', true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,8 @@ class Subscription extends Model
|
||||||
|
|
||||||
public $fillable = ['name', 'amount', 'fee_id'];
|
public $fillable = ['name', 'amount', 'fee_id'];
|
||||||
|
|
||||||
public function fee(): BelongsTo {
|
public function fee(): BelongsTo
|
||||||
|
{
|
||||||
return $this->belongsTo(Fee::class);
|
return $this->belongsTo(Fee::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ class SubscriptionController extends Controller
|
||||||
|
|
||||||
return \Inertia::render('subscription/SubscriptionIndex', [
|
return \Inertia::render('subscription/SubscriptionIndex', [
|
||||||
'data' => SubscriptionResource::collection(Subscription::get()),
|
'data' => SubscriptionResource::collection(Subscription::get()),
|
||||||
'toolbar' => [ ['href' => route('subscription.create'), 'label' => 'Beitrag anlegen', 'color' => 'primary', 'icon' => 'plus'] ],
|
'toolbar' => [['href' => route('subscription.create'), 'label' => 'Beitrag anlegen', 'color' => 'primary', 'icon' => 'plus']],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class SubscriptionController extends Controller
|
||||||
return \Inertia::render('subscription/SubscriptionForm', [
|
return \Inertia::render('subscription/SubscriptionForm', [
|
||||||
'fees' => Fee::pluck('name', 'id'),
|
'fees' => Fee::pluck('name', 'id'),
|
||||||
'mode' => 'create',
|
'mode' => 'create',
|
||||||
'data' => (object) []
|
'data' => (object) [],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,8 @@ class SubscriptionResource extends JsonResource
|
||||||
/**
|
/**
|
||||||
* Transform the resource into an array.
|
* Transform the resource into an array.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function toArray($request)
|
public function toArray($request)
|
||||||
|
|
|
@ -8,7 +8,6 @@ use Illuminate\Support\Collection;
|
||||||
|
|
||||||
class BillType extends Repository implements PdfRepository
|
class BillType extends Repository implements PdfRepository
|
||||||
{
|
{
|
||||||
|
|
||||||
public string $filename;
|
public string $filename;
|
||||||
|
|
||||||
public function getPayments(Member $member): Collection
|
public function getPayments(Member $member): Collection
|
||||||
|
@ -97,7 +96,7 @@ class BillType extends Repository implements PdfRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Descriptions for sendpayment page
|
* Get Descriptions for sendpayment page.
|
||||||
*
|
*
|
||||||
* @return array<int, string>
|
* @return array<int, string>
|
||||||
*/
|
*/
|
||||||
|
@ -118,5 +117,4 @@ class BillType extends Repository implements PdfRepository
|
||||||
{
|
{
|
||||||
return 'Jahresrechnung';
|
return 'Jahresrechnung';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ use Illuminate\Http\Response;
|
||||||
|
|
||||||
class MemberPdfController extends Controller
|
class MemberPdfController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Response|Responsable
|
* @return Response|Responsable
|
||||||
*/
|
*/
|
||||||
|
@ -18,9 +17,8 @@ class MemberPdfController extends Controller
|
||||||
{
|
{
|
||||||
$repo = app(PdfRepositoryFactory::class)->fromSingleRequest($request->type, $member);
|
$repo = app(PdfRepositoryFactory::class)->fromSingleRequest($request->type, $member);
|
||||||
|
|
||||||
return $repo === null
|
return null === $repo
|
||||||
? response()->noContent()
|
? response()->noContent()
|
||||||
: app(PdfGenerator::class)->setRepository($repo)->render();
|
: app(PdfGenerator::class)->setRepository($repo)->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ use Storage;
|
||||||
|
|
||||||
class PdfGenerator implements Responsable
|
class PdfGenerator implements Responsable
|
||||||
{
|
{
|
||||||
|
|
||||||
private ?string $filename = null;
|
private ?string $filename = null;
|
||||||
private PdfRepository $repo;
|
private PdfRepository $repo;
|
||||||
private string $dir;
|
private string $dir;
|
||||||
|
@ -62,5 +61,4 @@ class PdfGenerator implements Responsable
|
||||||
$templatePath = resource_path("views/tex/templates/{$this->repo->getTemplate()}");
|
$templatePath = resource_path("views/tex/templates/{$this->repo->getTemplate()}");
|
||||||
exec('cp '.$templatePath.'/* '.$destination);
|
exec('cp '.$templatePath.'/* '.$destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ use Illuminate\Support\Collection;
|
||||||
|
|
||||||
interface PdfRepository
|
interface PdfRepository
|
||||||
{
|
{
|
||||||
|
|
||||||
public function getSubject(): string;
|
public function getSubject(): string;
|
||||||
|
|
||||||
public function setFilename(string $filename): self;
|
public function setFilename(string $filename): self;
|
||||||
|
@ -52,5 +51,4 @@ interface PdfRepository
|
||||||
public function getMailSubject(): string;
|
public function getMailSubject(): string;
|
||||||
|
|
||||||
public function allPayments(): Generator;
|
public function allPayments(): Generator;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ use Illuminate\Support\Str;
|
||||||
|
|
||||||
class PdfRepositoryFactory
|
class PdfRepositoryFactory
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array<int, class-string<PdfRepository>>
|
* @var array<int, class-string<PdfRepository>>
|
||||||
*/
|
*/
|
||||||
|
@ -23,7 +22,7 @@ class PdfRepositoryFactory
|
||||||
*/
|
*/
|
||||||
public function getTypes(): Collection
|
public function getTypes(): Collection
|
||||||
{
|
{
|
||||||
return collect(array_map(fn ($classString) => new $classString, $this->types));
|
return collect(array_map(fn ($classString) => new $classString(), $this->types));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fromSingleRequest(string $type, Member $member): ?PdfRepository
|
public function fromSingleRequest(string $type, Member $member): ?PdfRepository
|
||||||
|
@ -108,5 +107,4 @@ class PdfRepositoryFactory
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ use Illuminate\Support\Collection;
|
||||||
|
|
||||||
class RememberType extends Repository implements PdfRepository
|
class RememberType extends Repository implements PdfRepository
|
||||||
{
|
{
|
||||||
|
|
||||||
public string $filename;
|
public string $filename;
|
||||||
|
|
||||||
public function getPayments(Member $member): Collection
|
public function getPayments(Member $member): Collection
|
||||||
|
@ -97,7 +96,7 @@ class RememberType extends Repository implements PdfRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Descriptions for sendpayment page
|
* Get Descriptions for sendpayment page.
|
||||||
*
|
*
|
||||||
* @return array<int, string>
|
* @return array<int, string>
|
||||||
*/
|
*/
|
||||||
|
@ -118,5 +117,4 @@ class RememberType extends Repository implements PdfRepository
|
||||||
{
|
{
|
||||||
return 'Zahlungserinnerung';
|
return 'Zahlungserinnerung';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ use Illuminate\Support\Collection;
|
||||||
|
|
||||||
abstract class Repository
|
abstract class Repository
|
||||||
{
|
{
|
||||||
|
|
||||||
abstract public function getPayments(Member $member): Collection;
|
abstract public function getPayments(Member $member): Collection;
|
||||||
|
|
||||||
public Collection $pages;
|
public Collection $pages;
|
||||||
|
@ -31,7 +30,7 @@ abstract class Repository
|
||||||
|
|
||||||
public function createable(Member $member): bool
|
public function createable(Member $member): bool
|
||||||
{
|
{
|
||||||
return $this->getPayments($member)->count() !== 0;
|
return 0 !== $this->getPayments($member)->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function allPayments(): Generator
|
public function allPayments(): Generator
|
||||||
|
@ -44,5 +43,4 @@ abstract class Repository
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,8 @@
|
||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use App\Setting\GeneralSettings;
|
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
use Illuminate\Support\Facades\Event;
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Laravel\Telescope\Telescope;
|
use Laravel\Telescope\Telescope;
|
||||||
|
|
||||||
|
@ -23,7 +21,7 @@ class AppServiceProvider extends ServiceProvider
|
||||||
|
|
||||||
\Inertia::share('search', request()->query('search', ''));
|
\Inertia::share('search', request()->query('search', ''));
|
||||||
|
|
||||||
RedirectResponse::macro('success', function($flash) {
|
RedirectResponse::macro('success', function ($flash) {
|
||||||
session()->flash('flash', ['success' => $flash]);
|
session()->flash('flash', ['success' => $flash]);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -37,6 +35,5 @@ class AppServiceProvider extends ServiceProvider
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
//
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||||
use Illuminate\Support\Facades\Gate;
|
|
||||||
|
|
||||||
class AuthServiceProvider extends ServiceProvider
|
class AuthServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
@ -24,7 +23,5 @@ class AuthServiceProvider extends ServiceProvider
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
$this->registerPolicies();
|
$this->registerPolicies();
|
||||||
|
|
||||||
//
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,5 @@ class EventServiceProvider extends ServiceProvider
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
parent::boot();
|
parent::boot();
|
||||||
|
|
||||||
//
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,6 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider
|
||||||
{
|
{
|
||||||
Gate::define('viewHorizon', function ($user) {
|
Gate::define('viewHorizon', function ($user) {
|
||||||
return in_array($user->email, [
|
return in_array($user->email, [
|
||||||
//
|
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,6 @@ class RouteServiceProvider extends ServiceProvider
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
//
|
|
||||||
|
|
||||||
parent::boot();
|
parent::boot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
|
||||||
protected function gate()
|
protected function gate()
|
||||||
{
|
{
|
||||||
Gate::define('viewTelescope', function ($user) {
|
Gate::define('viewTelescope', function ($user) {
|
||||||
return $user->mglnr == 90166;
|
return 90166 == $user->mglnr;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,6 @@ class Region extends Model
|
||||||
public $fillable = ['name', 'nami_id', 'is_null'];
|
public $fillable = ['name', 'nami_id', 'is_null'];
|
||||||
|
|
||||||
public $casts = [
|
public $casts = [
|
||||||
'is_null' => 'boolean'
|
'is_null' => 'boolean',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,11 @@ namespace App\Setting\Controllers;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Setting\GeneralSettings;
|
use App\Setting\GeneralSettings;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Inertia\Inertia;
|
use Inertia\Inertia;
|
||||||
use Inertia\Response;
|
use Inertia\Response;
|
||||||
|
|
||||||
class SettingController extends Controller
|
class SettingController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @wip
|
* @wip
|
||||||
*/
|
*/
|
||||||
|
@ -18,12 +16,11 @@ class SettingController extends Controller
|
||||||
{
|
{
|
||||||
return Inertia::render('setting/Index', [
|
return Inertia::render('setting/Index', [
|
||||||
'options' => [
|
'options' => [
|
||||||
'modules' => $generalSettings->moduleOptions()
|
'modules' => $generalSettings->moduleOptions(),
|
||||||
],
|
],
|
||||||
'general' => [
|
'general' => [
|
||||||
'modules' => $generalSettings->modules
|
'modules' => $generalSettings->modules,
|
||||||
]
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ use Spatie\LaravelSettings\Settings;
|
||||||
|
|
||||||
class GeneralSettings extends Settings
|
class GeneralSettings extends Settings
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var array<int, string> */
|
/** @var array<int, string> */
|
||||||
public array $modules;
|
public array $modules;
|
||||||
|
|
||||||
|
@ -34,5 +33,4 @@ class GeneralSettings extends Settings
|
||||||
{
|
{
|
||||||
return in_array($module, $this->modules);
|
return in_array($module, $this->modules);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ use Zoomyboy\LaravelNami\Nami;
|
||||||
|
|
||||||
class NamiSettings extends Settings
|
class NamiSettings extends Settings
|
||||||
{
|
{
|
||||||
|
|
||||||
public int $mglnr;
|
public int $mglnr;
|
||||||
|
|
||||||
public string $password;
|
public string $password;
|
||||||
|
@ -22,5 +21,4 @@ class NamiSettings extends Settings
|
||||||
{
|
{
|
||||||
return Nami::login($this->mglnr, $this->password);
|
return Nami::login($this->mglnr, $this->password);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
|
||||||
class Subactivity extends Model
|
class Subactivity extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
use HasNamiField;
|
use HasNamiField;
|
||||||
use Sluggable;
|
use Sluggable;
|
||||||
|
@ -36,5 +35,4 @@ class Subactivity extends Model
|
||||||
{
|
{
|
||||||
return $this->belongsToMany(Activity::class);
|
return $this->belongsToMany(Activity::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,5 @@ use Illuminate\View\Compilers\BladeCompiler;
|
||||||
|
|
||||||
class TexCompiler extends BladeCompiler
|
class TexCompiler extends BladeCompiler
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $contentTags = ['<<<', '>>>'];
|
protected $contentTags = ['<<<', '>>>'];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
namespace App\Tex;
|
namespace App\Tex;
|
||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Illuminate\View\Compilers\BladeCompiler;
|
|
||||||
use Illuminate\View\DynamicComponent;
|
|
||||||
use Illuminate\View\Engines\CompilerEngine;
|
use Illuminate\View\Engines\CompilerEngine;
|
||||||
|
|
||||||
class TexServiceProvider extends ServiceProvider
|
class TexServiceProvider extends ServiceProvider
|
||||||
|
@ -16,7 +14,7 @@ class TexServiceProvider extends ServiceProvider
|
||||||
*/
|
*/
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
view()->addExtension('tex', 'tex', function() {
|
view()->addExtension('tex', 'tex', function () {
|
||||||
$compiler = new TexCompiler(app('files'), config('view.compiled'));
|
$compiler = new TexCompiler(app('files'), config('view.compiled'));
|
||||||
|
|
||||||
return new CompilerEngine($compiler, app('files'));
|
return new CompilerEngine($compiler, app('files'));
|
||||||
|
@ -30,6 +28,5 @@ class TexServiceProvider extends ServiceProvider
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
//
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,15 +2,10 @@
|
||||||
|
|
||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Notifications\Notifiable;
|
|
||||||
|
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable
|
||||||
{
|
{
|
||||||
|
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
*/
|
*/
|
||||||
class ActivityFactory extends Factory
|
class ActivityFactory extends Factory
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $model = Activity::class;
|
protected $model = Activity::class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,5 +29,4 @@ class ActivityFactory extends Factory
|
||||||
{
|
{
|
||||||
return $this->state(['nami_id' => $namiId]);
|
return $this->state(['nami_id' => $namiId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
class ConfessionFactory extends Factory
|
class ConfessionFactory extends Factory
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $model = Confession::class;
|
protected $model = Confession::class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,7 +7,6 @@ use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
class CountryFactory extends Factory
|
class CountryFactory extends Factory
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $model = Country::class;
|
protected $model = Country::class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,7 +10,6 @@ use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
*/
|
*/
|
||||||
class CourseFactory extends Factory
|
class CourseFactory extends Factory
|
||||||
{
|
{
|
||||||
|
|
||||||
public $model = Course::class;
|
public $model = Course::class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,7 +7,6 @@ use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
class CourseMemberFactory extends Factory
|
class CourseMemberFactory extends Factory
|
||||||
{
|
{
|
||||||
|
|
||||||
public $model = CourseMember::class;
|
public $model = CourseMember::class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,7 +10,6 @@ use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
*/
|
*/
|
||||||
class FeeFactory extends Factory
|
class FeeFactory extends Factory
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $model = Fee::class;
|
protected $model = Fee::class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,7 +7,6 @@ use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
class GroupFactory extends Factory
|
class GroupFactory extends Factory
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $model = Group::class;
|
protected $model = Group::class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,7 +7,6 @@ use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
class NationalityFactory extends Factory
|
class NationalityFactory extends Factory
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $model = Nationality::class;
|
protected $model = Nationality::class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,7 +10,6 @@ use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
class PaymentFactory extends Factory
|
class PaymentFactory extends Factory
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $model = Payment::class;
|
protected $model = Payment::class;
|
||||||
|
|
||||||
public function definition(): array
|
public function definition(): array
|
||||||
|
@ -44,5 +43,4 @@ class PaymentFactory extends Factory
|
||||||
Subscription::factory()->state(['name' => $name, 'amount' => $amount])->for(Fee::first()),
|
Subscription::factory()->state(['name' => $name, 'amount' => $amount])->for(Fee::first()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
class StatusFactory extends Factory
|
class StatusFactory extends Factory
|
||||||
{
|
{
|
||||||
|
|
||||||
public $model = Status::class;
|
public $model = Status::class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -8,7 +8,6 @@ use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
class SubscriptionFactory extends Factory
|
class SubscriptionFactory extends Factory
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $model = Subscription::class;
|
protected $model = Subscription::class;
|
||||||
|
|
||||||
public function definition(): array
|
public function definition(): array
|
||||||
|
@ -19,5 +18,4 @@ class SubscriptionFactory extends Factory
|
||||||
'fee_id' => Fee::factory()->createOne()->id,
|
'fee_id' => Fee::factory()->createOne()->id,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
*/
|
*/
|
||||||
class SubactivityFactory extends Factory
|
class SubactivityFactory extends Factory
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $model = Subactivity::class;
|
protected $model = Subactivity::class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,5 +29,4 @@ class SubactivityFactory extends Factory
|
||||||
{
|
{
|
||||||
return $this->state(['nami_id' => $namiId]);
|
return $this->state(['nami_id' => $namiId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue