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