tenant admin startseite schicker gestaltet und super-admin und tenant admin (filament) aufgesplittet.
Es gibt nun task collections und vordefinierte tasks für alle. Onboarding verfeinert und webseite-carousel gefixt (logging später entfernen!)
This commit is contained in:
27
app/Http/Requests/Tenant/EmotionStoreRequest.php
Normal file
27
app/Http/Requests/Tenant/EmotionStoreRequest.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Tenant;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class EmotionStoreRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'description' => ['nullable', 'string'],
|
||||
'icon' => ['nullable', 'string', 'max:50'],
|
||||
'color' => ['nullable', 'string', 'regex:/^#?[0-9a-fA-F]{6}$/'],
|
||||
'sort_order' => ['nullable', 'integer'],
|
||||
'is_active' => ['nullable', 'boolean'],
|
||||
'event_type_ids' => ['nullable', 'array'],
|
||||
'event_type_ids.*' => ['integer', 'exists:event_types,id'],
|
||||
];
|
||||
}
|
||||
}
|
||||
27
app/Http/Requests/Tenant/EmotionUpdateRequest.php
Normal file
27
app/Http/Requests/Tenant/EmotionUpdateRequest.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Tenant;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class EmotionUpdateRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => ['sometimes', 'nullable', 'string', 'max:255'],
|
||||
'description' => ['sometimes', 'nullable', 'string'],
|
||||
'icon' => ['sometimes', 'nullable', 'string', 'max:50'],
|
||||
'color' => ['sometimes', 'nullable', 'string', 'regex:/^#?[0-9a-fA-F]{6}$/'],
|
||||
'sort_order' => ['sometimes', 'nullable', 'integer'],
|
||||
'is_active' => ['sometimes', 'boolean'],
|
||||
'event_type_ids' => ['sometimes', 'array'],
|
||||
'event_type_ids.*' => ['integer', 'exists:event_types,id'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,18 @@ class TaskStoreRequest extends FormRequest
|
||||
'description' => ['nullable', 'string'],
|
||||
'collection_id' => ['nullable', 'exists:task_collections,id', function ($attribute, $value, $fail) {
|
||||
$tenantId = request()->tenant?->id;
|
||||
if ($tenantId && !\App\Models\TaskCollection::where('id', $value)->where('tenant_id', $tenantId)->exists()) {
|
||||
|
||||
$accessible = \App\Models\TaskCollection::where('id', $value)
|
||||
->where(function ($query) use ($tenantId) {
|
||||
$query->whereNull('tenant_id');
|
||||
|
||||
if ($tenantId) {
|
||||
$query->orWhere('tenant_id', $tenantId);
|
||||
}
|
||||
})
|
||||
->exists();
|
||||
|
||||
if (! $accessible) {
|
||||
$fail('Die TaskCollection gehört nicht zu diesem Tenant.');
|
||||
}
|
||||
}],
|
||||
@@ -57,4 +68,4 @@ class TaskStoreRequest extends FormRequest
|
||||
'assigned_to.exists' => 'Der zugewiesene Benutzer existiert nicht.',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,18 @@ class TaskUpdateRequest extends FormRequest
|
||||
'description' => ['sometimes', 'nullable', 'string'],
|
||||
'collection_id' => ['sometimes', 'nullable', 'exists:task_collections,id', function ($attribute, $value, $fail) {
|
||||
$tenantId = request()->tenant?->id;
|
||||
if ($tenantId && !\App\Models\TaskCollection::where('id', $value)->where('tenant_id', $tenantId)->exists()) {
|
||||
|
||||
$accessible = \App\Models\TaskCollection::where('id', $value)
|
||||
->where(function ($query) use ($tenantId) {
|
||||
$query->whereNull('tenant_id');
|
||||
|
||||
if ($tenantId) {
|
||||
$query->orWhere('tenant_id', $tenantId);
|
||||
}
|
||||
})
|
||||
->exists();
|
||||
|
||||
if (! $accessible) {
|
||||
$fail('Die TaskCollection gehört nicht zu diesem Tenant.');
|
||||
}
|
||||
}],
|
||||
@@ -56,4 +67,4 @@ class TaskUpdateRequest extends FormRequest
|
||||
'assigned_to.exists' => 'Der zugewiesene Benutzer existiert nicht.',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user