PHP Cs Fixer

This commit is contained in:
Philipp Lang 2022-03-11 20:19:17 +01:00
parent f0256f39e7
commit d0c18fb78c
121 changed files with 312 additions and 447 deletions

View File

@ -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);
} }
} }

View File

@ -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'];

View File

@ -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;
} }

View File

@ -20,7 +20,6 @@ class Kernel extends ConsoleKernel
/** /**
* 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)

View File

@ -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;
} }

View File

@ -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
{ {

View File

@ -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
{ {

View File

@ -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());
} }
} }

View File

@ -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
{ {

View File

@ -14,6 +14,7 @@ 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)

View File

@ -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
@ -46,7 +43,7 @@ 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

View File

@ -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;

View File

@ -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'];

View File

@ -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');
} }
} }

View File

@ -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)

View File

@ -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;
} }

View File

@ -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' => [

View File

@ -10,6 +10,7 @@ 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)

View File

@ -12,6 +12,5 @@ class CheckForMaintenanceMode extends Middleware
* @var array * @var array
*/ */
protected $except = [ protected $except = [
//
]; ];
} }

View File

@ -12,6 +12,5 @@ class EncryptCookies extends Middleware
* @var array * @var array
*/ */
protected $except = [ protected $except = [
//
]; ];
} }

View File

@ -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)
@ -36,7 +35,7 @@ class InertiaShareMiddleware
}, },
'settings' => [ 'settings' => [
'modules' => app(GeneralSettings::class)->modules, 'modules' => app(GeneralSettings::class)->modules,
] ],
]); ]);
$response = $next($request); $response = $next($request);

View File

@ -12,8 +12,8 @@ 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)

View File

@ -6,14 +6,13 @@ 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)

View File

@ -12,6 +12,5 @@ class VerifyCsrfToken extends Middleware
* @var array * @var array
*/ */
protected $except = [ protected $except = [
//
]; ];
} }

View File

@ -14,6 +14,7 @@ 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'),
] ],
]; ];
} }
} }

View File

@ -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()),
] ],
]; ];
} }
} }

View File

@ -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
@ -14,6 +13,7 @@ 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)

View File

@ -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();
@ -70,5 +71,4 @@ class MemberView {
'statuses' => Status::pluck('name', 'id'), 'statuses' => Status::pluck('name', 'id'),
], $overwrites)); ], $overwrites));
} }
} }

View File

@ -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',
]; ];
@ -36,6 +36,4 @@ class ActivityCreator {
$activity->subactivities()->sync($groups); $activity->subactivities()->sync($groups);
}); });
} }
} }

View File

@ -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;
} }

View File

@ -5,12 +5,13 @@ 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;
} }

View File

@ -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

View File

@ -4,11 +4,12 @@ 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;
} }

View File

@ -5,11 +5,12 @@ 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;
} }

View File

@ -5,11 +5,12 @@ 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;
} }

View File

@ -4,11 +4,12 @@ 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;
} }

View File

@ -5,11 +5,12 @@ 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;
} }

View File

@ -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.

View File

@ -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;
} }
@ -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;
} }

View File

@ -5,11 +5,12 @@ 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;
} }

View File

@ -4,12 +4,13 @@ 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;
} }

View File

@ -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());
} }
} }
} }

View File

@ -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;
@ -84,6 +87,5 @@ class CreateJob implements ShouldQueue
'created_at' => $membership['starts_at'], 'created_at' => $membership['starts_at'],
]); ]);
} }
} }
} }

View File

@ -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;

View File

@ -18,7 +18,6 @@ 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;
@ -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;
} }
@ -170,64 +177,73 @@ class Member extends Model
} }
// ---------------------------------- 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),
]); ]);
} }
} }

View File

@ -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');
@ -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',
]); ]);

View File

@ -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,7 +59,8 @@ 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')) {
@ -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());
} }
} }

View File

@ -16,6 +16,7 @@ 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')),

View File

@ -23,5 +23,4 @@ class Membership extends Model
{ {
return $this->belongsTo(Subactivity::class); return $this->belongsTo(Subactivity::class);
} }
} }

View File

@ -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;

View File

@ -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();
} }
} }

View File

@ -13,6 +13,7 @@ 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)

View File

@ -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();
} }
} }

View File

@ -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;
} }
} }

View File

@ -9,7 +9,6 @@ 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 {
@ -33,5 +32,4 @@ class ActionFactory
]; ];
}); });
} }
} }

View File

@ -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) {

View File

@ -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;

View File

@ -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;

View File

@ -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')

View File

@ -13,6 +13,7 @@ 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(),
]; ];
} }
} }

View File

@ -77,5 +77,4 @@ class PaymentSendCommand extends Command
app(PdfRepositoryFactory::class)->afterSingle($repo); app(PdfRepositoryFactory::class)->afterSingle($repo);
} }
} }
} }

View File

@ -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;
} }
} }

View File

@ -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,7 +24,7 @@ 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 -----------------------------------

View File

@ -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);
} }
} }

View File

@ -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) [],
]); ]);
} }

View File

@ -13,6 +13,7 @@ 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)

View File

@ -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';
} }
} }

View File

@ -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();
} }
} }

View File

@ -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);
} }
} }

View File

@ -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;
} }

View File

@ -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
), ),
); );
} }
} }

View File

@ -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';
} }
} }

View File

@ -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
} }
} }
} }
} }

View File

@ -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;
@ -37,6 +35,5 @@ class AppServiceProvider extends ServiceProvider
*/ */
public function boot() public function boot()
{ {
//
} }
} }

View File

@ -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();
//
} }
} }

View File

@ -28,7 +28,5 @@ class EventServiceProvider extends ServiceProvider
public function boot() public function boot()
{ {
parent::boot(); parent::boot();
//
} }
} }

View File

@ -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, [
//
]); ]);
}); });
} }

View File

@ -30,8 +30,6 @@ class RouteServiceProvider extends ServiceProvider
*/ */
public function boot() public function boot()
{ {
//
parent::boot(); parent::boot();
} }

View File

@ -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;
}); });
} }
} }

View File

@ -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',
]; ];
} }

View File

@ -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,
] ],
]); ]);
} }
} }

View File

@ -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);
} }
} }

View File

@ -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);
} }
} }

View File

@ -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);
} }
} }

View File

@ -6,7 +6,5 @@ use Illuminate\View\Compilers\BladeCompiler;
class TexCompiler extends BladeCompiler class TexCompiler extends BladeCompiler
{ {
protected $contentTags = ['<<<', '>>>']; protected $contentTags = ['<<<', '>>>'];
} }

View File

@ -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
@ -30,6 +28,5 @@ class TexServiceProvider extends ServiceProvider
*/ */
public function boot() public function boot()
{ {
//
} }
} }

View File

@ -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;
} }

View File

@ -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]);
} }
} }

View File

@ -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;
/** /**

View File

@ -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;
/** /**

View File

@ -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;
/** /**

View File

@ -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;
/** /**

View File

@ -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;
/** /**

View File

@ -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;
/** /**

View File

@ -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;
/** /**

View File

@ -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()),
); );
} }
} }

View File

@ -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;
/** /**

View File

@ -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,
]; ];
} }
} }

View File

@ -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]);
} }
} }

View File

@ -11,7 +11,6 @@ use Illuminate\Support\Facades\Hash;
*/ */
class UserFactory extends Factory class UserFactory extends Factory
{ {
protected $model = User::class; protected $model = User::class;
/** /**

Some files were not shown because too many files have changed in this diff Show More