refactor: apply consistent formatting and organization across multiple files
This commit is contained in:
parent
e9237f857e
commit
04bff9773a
@ -32,8 +32,8 @@ public function handle(): int
|
|||||||
return Command::FAILURE;
|
return Command::FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
$employees = Employee::whereHas('user', fn($q) => $q->where('is_active', true))
|
$employees = Employee::whereHas('user', fn ($q) => $q->where('is_active', true))
|
||||||
->where(fn($q) => $q->whereNull('resign_date')->orWhere('resign_date', '>=', $now->toDateString()))
|
->where(fn ($q) => $q->whereNull('resign_date')->orWhere('resign_date', '>=', $now->toDateString()))
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
$existingPayrollEmployeeIds = Payroll::where('payroll_period_id', $period->id)
|
$existingPayrollEmployeeIds = Payroll::where('payroll_period_id', $period->id)
|
||||||
|
|||||||
@ -3,8 +3,8 @@
|
|||||||
namespace App\Http\Controllers\Admin;
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests\Admin\Settings\UpdateHRRequest;
|
|
||||||
use App\Http\Requests\Admin\Settings\UpdateHomepageRequest;
|
use App\Http\Requests\Admin\Settings\UpdateHomepageRequest;
|
||||||
|
use App\Http\Requests\Admin\Settings\UpdateHRRequest;
|
||||||
use App\Http\Requests\Admin\Settings\UpdateMarketplaceRequest;
|
use App\Http\Requests\Admin\Settings\UpdateMarketplaceRequest;
|
||||||
use App\Http\Requests\Admin\Settings\UpdateSocialMediaRequest;
|
use App\Http\Requests\Admin\Settings\UpdateSocialMediaRequest;
|
||||||
use App\Http\Requests\Admin\Settings\UpdateSystemRequest;
|
use App\Http\Requests\Admin\Settings\UpdateSystemRequest;
|
||||||
|
|||||||
@ -33,7 +33,7 @@ public function create(): Response
|
|||||||
public function store(RoleRequest $request): RedirectResponse
|
public function store(RoleRequest $request): RedirectResponse
|
||||||
{
|
{
|
||||||
return $this->handleAction(
|
return $this->handleAction(
|
||||||
fn() => $this->service->create($request->validated()),
|
fn () => $this->service->create($request->validated()),
|
||||||
'Role berhasil ditambahkan.',
|
'Role berhasil ditambahkan.',
|
||||||
'admin.settings.roles.index'
|
'admin.settings.roles.index'
|
||||||
);
|
);
|
||||||
@ -50,7 +50,7 @@ public function edit(Role $role): Response
|
|||||||
public function update(RoleRequest $request, Role $role): RedirectResponse
|
public function update(RoleRequest $request, Role $role): RedirectResponse
|
||||||
{
|
{
|
||||||
return $this->handleAction(
|
return $this->handleAction(
|
||||||
fn() => $this->service->update($role, $request->validated()),
|
fn () => $this->service->update($role, $request->validated()),
|
||||||
'Role berhasil diperbarui.',
|
'Role berhasil diperbarui.',
|
||||||
'admin.settings.roles.index'
|
'admin.settings.roles.index'
|
||||||
);
|
);
|
||||||
|
|||||||
@ -34,7 +34,6 @@ public function update(PasswordUpdateRequest $request): RedirectResponse
|
|||||||
|
|
||||||
Inertia::flash('toast', ['type' => 'success', 'message' => 'Kata sandi berhasil diperbarui.']);
|
Inertia::flash('toast', ['type' => 'success', 'message' => 'Kata sandi berhasil diperbarui.']);
|
||||||
|
|
||||||
|
|
||||||
return back();
|
return back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
namespace App\Http\Requests\Admin\HR;
|
namespace App\Http\Requests\Admin\HR;
|
||||||
|
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Override;
|
|
||||||
|
|
||||||
class AttendanceRequest extends FormRequest
|
class AttendanceRequest extends FormRequest
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Requests\Settings;
|
namespace App\Http\Requests\Settings;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
@ -10,7 +11,7 @@ class ProfileUpdateRequest extends FormRequest
|
|||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
* @return array<string, ValidationRule|array<mixed>|string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
#[Guarded(['id'])]
|
#[Guarded(['id'])]
|
||||||
class CashTransaction extends Model implements HasMedia
|
class CashTransaction extends Model implements HasMedia
|
||||||
{
|
{
|
||||||
use HasFactory, SoftDeletes, InteractsWithMedia;
|
use HasFactory, InteractsWithMedia, SoftDeletes;
|
||||||
|
|
||||||
protected function casts(): array
|
protected function casts(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
#[Guarded(['id'])]
|
#[Guarded(['id'])]
|
||||||
class Expense extends Model implements HasMedia
|
class Expense extends Model implements HasMedia
|
||||||
{
|
{
|
||||||
use HasFactory, SoftDeletes, InteractsWithMedia;
|
use HasFactory, InteractsWithMedia, SoftDeletes;
|
||||||
|
|
||||||
protected function casts(): array
|
protected function casts(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@ -42,14 +42,14 @@ protected function active(Builder $query): void
|
|||||||
protected function name(): Attribute
|
protected function name(): Attribute
|
||||||
{
|
{
|
||||||
return Attribute::make(
|
return Attribute::make(
|
||||||
get: fn() => $this->userProfile?->full_name ?? '',
|
get: fn () => $this->userProfile?->full_name ?? '',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function fullName(): Attribute
|
protected function fullName(): Attribute
|
||||||
{
|
{
|
||||||
return Attribute::make(
|
return Attribute::make(
|
||||||
get: fn() => $this->userProfile?->full_name ?? '',
|
get: fn () => $this->userProfile?->full_name ?? '',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,8 +3,8 @@
|
|||||||
namespace App\Services\Admin;
|
namespace App\Services\Admin;
|
||||||
|
|
||||||
use App\Services\S3PresignedService;
|
use App\Services\S3PresignedService;
|
||||||
use App\Settings\HRSettings;
|
|
||||||
use App\Settings\HomepageSettings;
|
use App\Settings\HomepageSettings;
|
||||||
|
use App\Settings\HRSettings;
|
||||||
use App\Settings\MarketplaceSettings;
|
use App\Settings\MarketplaceSettings;
|
||||||
use App\Settings\SocialMediaSettings;
|
use App\Settings\SocialMediaSettings;
|
||||||
use App\Settings\SystemSettings;
|
use App\Settings\SystemSettings;
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Services\Admin\HR;
|
namespace App\Services\Admin\HR;
|
||||||
|
|
||||||
use App\Enums\LeaveRequestStatus;
|
|
||||||
use App\Models\Attendance;
|
use App\Models\Attendance;
|
||||||
use App\Models\LeaveRequest;
|
use App\Models\LeaveRequest;
|
||||||
use App\Services\S3PresignedService;
|
use App\Services\S3PresignedService;
|
||||||
@ -76,6 +75,7 @@ public function getMonthStats(int $year, int $month): array
|
|||||||
$leaveStart = max($leave->start_date->timestamp, $startOfMonth->timestamp);
|
$leaveStart = max($leave->start_date->timestamp, $startOfMonth->timestamp);
|
||||||
$leaveEnd = min($leave->end_date->timestamp, $endOfMonth->timestamp);
|
$leaveEnd = min($leave->end_date->timestamp, $endOfMonth->timestamp);
|
||||||
$days = Carbon::createFromTimestamp($leaveStart)->diffInDays(Carbon::createFromTimestamp($leaveEnd)) + 1;
|
$days = Carbon::createFromTimestamp($leaveStart)->diffInDays(Carbon::createFromTimestamp($leaveEnd)) + 1;
|
||||||
|
|
||||||
return $carry + max(0, $days);
|
return $carry + max(0, $days);
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ private function formatAttendance(Attendance $attendance): array
|
|||||||
$toArray = $attendance->toArray();
|
$toArray = $attendance->toArray();
|
||||||
|
|
||||||
if (is_null($toArray['work_duration_minutes']) && $attendance->check_in_at) {
|
if (is_null($toArray['work_duration_minutes']) && $attendance->check_in_at) {
|
||||||
$checkIn = \Carbon\Carbon::parse($attendance->check_in_at);
|
$checkIn = Carbon::parse($attendance->check_in_at);
|
||||||
$end = $checkIn->toDateString() === now()->toDateString()
|
$end = $checkIn->toDateString() === now()->toDateString()
|
||||||
? now()
|
? now()
|
||||||
: $checkIn->copy()->endOfDay();
|
: $checkIn->copy()->endOfDay();
|
||||||
@ -166,8 +166,8 @@ private function registerMedia(Attendance $attendance, string $photo, string $ty
|
|||||||
if (str_starts_with($photo, 'data:image')) {
|
if (str_starts_with($photo, 'data:image')) {
|
||||||
$base64 = explode(',', $photo)[1];
|
$base64 = explode(',', $photo)[1];
|
||||||
$imageData = base64_decode($base64);
|
$imageData = base64_decode($base64);
|
||||||
$filename = $type . '_' . time() . '_' . uniqid() . '.jpg';
|
$filename = $type.'_'.time().'_'.uniqid().'.jpg';
|
||||||
$s3Key = 'attendances/' . $filename;
|
$s3Key = 'attendances/'.$filename;
|
||||||
|
|
||||||
app('filesystem')->disk('s3')->put($s3Key, $imageData);
|
app('filesystem')->disk('s3')->put($s3Key, $imageData);
|
||||||
$mimeType = 'image/jpeg';
|
$mimeType = 'image/jpeg';
|
||||||
|
|||||||
@ -7,8 +7,11 @@
|
|||||||
class HRSettings extends Settings
|
class HRSettings extends Settings
|
||||||
{
|
{
|
||||||
public string $scheduled_check_in_time;
|
public string $scheduled_check_in_time;
|
||||||
|
|
||||||
public string $scheduled_check_out_time;
|
public string $scheduled_check_out_time;
|
||||||
|
|
||||||
public int $late_penalty_amount;
|
public int $late_penalty_amount;
|
||||||
|
|
||||||
public int $absent_penalty_amount;
|
public int $absent_penalty_amount;
|
||||||
|
|
||||||
public static function group(): string
|
public static function group(): string
|
||||||
|
|||||||
@ -7,45 +7,71 @@
|
|||||||
class HomepageSettings extends Settings
|
class HomepageSettings extends Settings
|
||||||
{
|
{
|
||||||
public string $hero_badge;
|
public string $hero_badge;
|
||||||
|
|
||||||
public string $hero_title_line1;
|
public string $hero_title_line1;
|
||||||
|
|
||||||
public string $hero_title_line2;
|
public string $hero_title_line2;
|
||||||
|
|
||||||
public string $hero_title_highlight;
|
public string $hero_title_highlight;
|
||||||
|
|
||||||
public string $hero_description;
|
public string $hero_description;
|
||||||
|
|
||||||
public string $hero_cta_primary_text;
|
public string $hero_cta_primary_text;
|
||||||
|
|
||||||
public string $hero_cta_secondary_text;
|
public string $hero_cta_secondary_text;
|
||||||
|
|
||||||
public ?string $hero_image_url;
|
public ?string $hero_image_url;
|
||||||
|
|
||||||
public string $hero_bg_text_left;
|
public string $hero_bg_text_left;
|
||||||
|
|
||||||
public string $hero_bg_text_right;
|
public string $hero_bg_text_right;
|
||||||
|
|
||||||
public string $scroll_hashtag;
|
public string $scroll_hashtag;
|
||||||
|
|
||||||
public string $scroll_tagline;
|
public string $scroll_tagline;
|
||||||
|
|
||||||
public string $catalog_badge;
|
public string $catalog_badge;
|
||||||
|
|
||||||
public string $catalog_title;
|
public string $catalog_title;
|
||||||
|
|
||||||
public string $catalog_description;
|
public string $catalog_description;
|
||||||
|
|
||||||
public string $catalog_search_placeholder;
|
public string $catalog_search_placeholder;
|
||||||
|
|
||||||
public string $gallery_badge;
|
public string $gallery_badge;
|
||||||
|
|
||||||
public string $gallery_title;
|
public string $gallery_title;
|
||||||
|
|
||||||
public string $gallery_description;
|
public string $gallery_description;
|
||||||
|
|
||||||
public array $gallery_images;
|
public array $gallery_images;
|
||||||
|
|
||||||
public string $order_guide_badge;
|
public string $order_guide_badge;
|
||||||
|
|
||||||
public string $order_guide_title;
|
public string $order_guide_title;
|
||||||
|
|
||||||
public string $order_guide_description;
|
public string $order_guide_description;
|
||||||
|
|
||||||
public array $order_steps;
|
public array $order_steps;
|
||||||
|
|
||||||
public string $about_badge;
|
public string $about_badge;
|
||||||
|
|
||||||
public string $about_title;
|
public string $about_title;
|
||||||
|
|
||||||
public ?string $about_image_url;
|
public ?string $about_image_url;
|
||||||
|
|
||||||
public array $about_features;
|
public array $about_features;
|
||||||
|
|
||||||
public string $contact_badge;
|
public string $contact_badge;
|
||||||
|
|
||||||
public string $contact_title;
|
public string $contact_title;
|
||||||
|
|
||||||
public string $contact_description;
|
public string $contact_description;
|
||||||
|
|
||||||
public string $contact_form_title;
|
public string $contact_form_title;
|
||||||
|
|
||||||
public string $footer_description;
|
public string $footer_description;
|
||||||
|
|
||||||
public string $footer_copyright;
|
public string $footer_copyright;
|
||||||
|
|
||||||
public static function group(): string
|
public static function group(): string
|
||||||
|
|||||||
@ -8,20 +8,33 @@
|
|||||||
class MarketplaceSettings extends Settings
|
class MarketplaceSettings extends Settings
|
||||||
{
|
{
|
||||||
public MarketplaceFeeRule $tiktok_shop_platform_commission;
|
public MarketplaceFeeRule $tiktok_shop_platform_commission;
|
||||||
|
|
||||||
public MarketplaceFeeRule $tiktok_shop_logistics_service_fee;
|
public MarketplaceFeeRule $tiktok_shop_logistics_service_fee;
|
||||||
|
|
||||||
public MarketplaceFeeRule $tiktok_shop_dynamic_commission;
|
public MarketplaceFeeRule $tiktok_shop_dynamic_commission;
|
||||||
|
|
||||||
public MarketplaceFeeRule $tiktok_shop_order_processing_fee;
|
public MarketplaceFeeRule $tiktok_shop_order_processing_fee;
|
||||||
|
|
||||||
public MarketplaceFeeRule $tiktok_shop_affiliate;
|
public MarketplaceFeeRule $tiktok_shop_affiliate;
|
||||||
|
|
||||||
public MarketplaceFeeRule $tiktok_shop_pre_order_service_fee;
|
public MarketplaceFeeRule $tiktok_shop_pre_order_service_fee;
|
||||||
|
|
||||||
public MarketplaceFeeRule $shopee_admin_fee;
|
public MarketplaceFeeRule $shopee_admin_fee;
|
||||||
|
|
||||||
public MarketplaceFeeRule $shopee_program_fee;
|
public MarketplaceFeeRule $shopee_program_fee;
|
||||||
|
|
||||||
public MarketplaceFeeRule $shopee_shipping_savings;
|
public MarketplaceFeeRule $shopee_shipping_savings;
|
||||||
|
|
||||||
public MarketplaceFeeRule $shopee_premium;
|
public MarketplaceFeeRule $shopee_premium;
|
||||||
|
|
||||||
public MarketplaceFeeRule $shopee_service_fee;
|
public MarketplaceFeeRule $shopee_service_fee;
|
||||||
|
|
||||||
public MarketplaceFeeRule $shopee_order_processing_fee;
|
public MarketplaceFeeRule $shopee_order_processing_fee;
|
||||||
|
|
||||||
public MarketplaceFeeRule $shopee_ams_commission_fee;
|
public MarketplaceFeeRule $shopee_ams_commission_fee;
|
||||||
|
|
||||||
public MarketplaceFeeRule $shopee_pre_order;
|
public MarketplaceFeeRule $shopee_pre_order;
|
||||||
|
|
||||||
public MarketplaceFeeRule $shopee_live_extra;
|
public MarketplaceFeeRule $shopee_live_extra;
|
||||||
|
|
||||||
public static function group(): string
|
public static function group(): string
|
||||||
|
|||||||
@ -7,7 +7,9 @@
|
|||||||
class SocialMediaSettings extends Settings
|
class SocialMediaSettings extends Settings
|
||||||
{
|
{
|
||||||
public ?string $instagram_url;
|
public ?string $instagram_url;
|
||||||
|
|
||||||
public ?string $facebook_url;
|
public ?string $facebook_url;
|
||||||
|
|
||||||
public ?string $tiktok_url;
|
public ?string $tiktok_url;
|
||||||
|
|
||||||
public static function group(): string
|
public static function group(): string
|
||||||
|
|||||||
@ -7,9 +7,13 @@
|
|||||||
class SystemSettings extends Settings
|
class SystemSettings extends Settings
|
||||||
{
|
{
|
||||||
public string $app_name;
|
public string $app_name;
|
||||||
|
|
||||||
public ?string $address;
|
public ?string $address;
|
||||||
|
|
||||||
public ?string $about_app;
|
public ?string $about_app;
|
||||||
|
|
||||||
public ?string $email;
|
public ?string $email;
|
||||||
|
|
||||||
public ?string $phone;
|
public ?string $phone;
|
||||||
|
|
||||||
public static function group(): string
|
public static function group(): string
|
||||||
|
|||||||
@ -7,15 +7,15 @@
|
|||||||
use Illuminate\Foundation\Configuration\Middleware;
|
use Illuminate\Foundation\Configuration\Middleware;
|
||||||
use Illuminate\Http\Middleware\AddLinkHeadersForPreloadedAssets;
|
use Illuminate\Http\Middleware\AddLinkHeadersForPreloadedAssets;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Spatie\Permission\Middleware\RoleMiddleware;
|
|
||||||
use Spatie\Permission\Middleware\PermissionMiddleware;
|
use Spatie\Permission\Middleware\PermissionMiddleware;
|
||||||
|
use Spatie\Permission\Middleware\RoleMiddleware;
|
||||||
use Spatie\Permission\Middleware\RoleOrPermissionMiddleware;
|
use Spatie\Permission\Middleware\RoleOrPermissionMiddleware;
|
||||||
|
|
||||||
return Application::configure(basePath: dirname(__DIR__))
|
return Application::configure(basePath: dirname(__DIR__))
|
||||||
->withRouting(
|
->withRouting(
|
||||||
web: __DIR__ . '/../routes/web.php',
|
web: __DIR__.'/../routes/web.php',
|
||||||
api: __DIR__ . '/../routes/api.php',
|
api: __DIR__.'/../routes/api.php',
|
||||||
commands: __DIR__ . '/../routes/console.php',
|
commands: __DIR__.'/../routes/console.php',
|
||||||
health: '/up',
|
health: '/up',
|
||||||
)
|
)
|
||||||
->withMiddleware(function (Middleware $middleware): void {
|
->withMiddleware(function (Middleware $middleware): void {
|
||||||
@ -35,6 +35,6 @@
|
|||||||
})
|
})
|
||||||
->withExceptions(function (Exceptions $exceptions): void {
|
->withExceptions(function (Exceptions $exceptions): void {
|
||||||
$exceptions->shouldRenderJsonWhen(
|
$exceptions->shouldRenderJsonWhen(
|
||||||
fn(Request $request) => $request->is('api/*') || $request->expectsJson(),
|
fn (Request $request) => $request->is('api/*') || $request->expectsJson(),
|
||||||
);
|
);
|
||||||
})->create();
|
})->create();
|
||||||
|
|||||||
@ -1,5 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Spatie\LaravelData\Data;
|
||||||
|
use Spatie\LaravelSettings\SettingsCasts\DataCast;
|
||||||
|
use Spatie\LaravelSettings\SettingsCasts\DateTimeInterfaceCast;
|
||||||
|
use Spatie\LaravelSettings\SettingsCasts\DateTimeZoneCast;
|
||||||
|
use Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository;
|
||||||
|
use Spatie\LaravelSettings\SettingsRepositories\RedisSettingsRepository;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -35,13 +42,13 @@
|
|||||||
*/
|
*/
|
||||||
'repositories' => [
|
'repositories' => [
|
||||||
'database' => [
|
'database' => [
|
||||||
'type' => Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class,
|
'type' => DatabaseSettingsRepository::class,
|
||||||
'model' => null,
|
'model' => null,
|
||||||
'table' => null,
|
'table' => null,
|
||||||
'connection' => null,
|
'connection' => null,
|
||||||
],
|
],
|
||||||
'redis' => [
|
'redis' => [
|
||||||
'type' => Spatie\LaravelSettings\SettingsRepositories\RedisSettingsRepository::class,
|
'type' => RedisSettingsRepository::class,
|
||||||
'connection' => null,
|
'connection' => null,
|
||||||
'prefix' => null,
|
'prefix' => null,
|
||||||
],
|
],
|
||||||
@ -61,7 +68,7 @@
|
|||||||
* additional prefix.
|
* additional prefix.
|
||||||
*/
|
*/
|
||||||
'cache' => [
|
'cache' => [
|
||||||
'enabled' => (bool)env('SETTINGS_CACHE_ENABLED', false),
|
'enabled' => (bool) env('SETTINGS_CACHE_ENABLED', false),
|
||||||
'store' => null,
|
'store' => null,
|
||||||
'prefix' => null,
|
'prefix' => null,
|
||||||
'ttl' => null,
|
'ttl' => null,
|
||||||
@ -78,10 +85,10 @@
|
|||||||
* your settings class isn't a default PHP type.
|
* your settings class isn't a default PHP type.
|
||||||
*/
|
*/
|
||||||
'global_casts' => [
|
'global_casts' => [
|
||||||
DateTimeInterface::class => Spatie\LaravelSettings\SettingsCasts\DateTimeInterfaceCast::class,
|
DateTimeInterface::class => DateTimeInterfaceCast::class,
|
||||||
DateTimeZone::class => Spatie\LaravelSettings\SettingsCasts\DateTimeZoneCast::class,
|
DateTimeZone::class => DateTimeZoneCast::class,
|
||||||
// Spatie\DataTransferObject\DataTransferObject::class => Spatie\LaravelSettings\SettingsCasts\DtoCast::class,
|
// Spatie\DataTransferObject\DataTransferObject::class => Spatie\LaravelSettings\SettingsCasts\DtoCast::class,
|
||||||
Spatie\LaravelData\Data::class => Spatie\LaravelSettings\SettingsCasts\DataCast::class,
|
Data::class => DataCast::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -5,12 +5,13 @@
|
|||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
use Spatie\Permission\Models\Permission;
|
use Spatie\Permission\Models\Permission;
|
||||||
use Spatie\Permission\Models\Role;
|
use Spatie\Permission\Models\Role;
|
||||||
|
use Spatie\Permission\PermissionRegistrar;
|
||||||
|
|
||||||
class RolePermissionSeeder extends Seeder
|
class RolePermissionSeeder extends Seeder
|
||||||
{
|
{
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
|
app()[PermissionRegistrar::class]->forgetCachedPermissions();
|
||||||
|
|
||||||
$permissions = [
|
$permissions = [
|
||||||
'user' => ['view', 'create', 'update', 'delete', 'toggle-active', 'reset-password'],
|
'user' => ['view', 'create', 'update', 'delete', 'toggle-active', 'reset-password'],
|
||||||
@ -39,7 +40,7 @@ public function run(): void
|
|||||||
$rolePermissions = [
|
$rolePermissions = [
|
||||||
'Developer' => $allPermissions,
|
'Developer' => $allPermissions,
|
||||||
|
|
||||||
'Owner' => array_filter($allPermissions, fn($p) => !str_starts_with($p, 'settings.update-')),
|
'Owner' => array_filter($allPermissions, fn ($p) => ! str_starts_with($p, 'settings.update-')),
|
||||||
|
|
||||||
'Direktur' => array_filter($allPermissions, function ($p) {
|
'Direktur' => array_filter($allPermissions, function ($p) {
|
||||||
return str_ends_with($p, '.view')
|
return str_ends_with($p, '.view')
|
||||||
@ -106,7 +107,7 @@ public function run(): void
|
|||||||
|| $p === 'attendance.check-out';
|
|| $p === 'attendance.check-out';
|
||||||
}),
|
}),
|
||||||
|
|
||||||
'Non Operator' => array_filter($allPermissions, fn($p) => str_ends_with($p, '.view')),
|
'Non Operator' => array_filter($allPermissions, fn ($p) => str_ends_with($p, '.view')),
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($rolePermissions as $roleName => $perms) {
|
foreach ($rolePermissions as $roleName => $perms) {
|
||||||
|
|||||||
@ -7,13 +7,12 @@
|
|||||||
use App\Http\Controllers\Admin\Finance\PayrollAdjustmentController;
|
use App\Http\Controllers\Admin\Finance\PayrollAdjustmentController;
|
||||||
use App\Http\Controllers\Admin\Finance\PayrollController;
|
use App\Http\Controllers\Admin\Finance\PayrollController;
|
||||||
use App\Http\Controllers\Admin\Finance\PayrollPeriodController;
|
use App\Http\Controllers\Admin\Finance\PayrollPeriodController;
|
||||||
use App\Http\Controllers\Admin\Master\CategoryController;
|
|
||||||
use App\Http\Controllers\Admin\Master\CustomerController;
|
|
||||||
use App\Http\Controllers\Admin\Master\ProductController;
|
|
||||||
use App\Http\Controllers\Admin\Master\SupplierController;
|
|
||||||
use App\Http\Controllers\Admin\HR\AttendanceController;
|
use App\Http\Controllers\Admin\HR\AttendanceController;
|
||||||
use App\Http\Controllers\Admin\HR\EmployeeController;
|
use App\Http\Controllers\Admin\HR\EmployeeController;
|
||||||
use App\Http\Controllers\Admin\HR\LeaveRequestController;
|
use App\Http\Controllers\Admin\HR\LeaveRequestController;
|
||||||
|
use App\Http\Controllers\Admin\Master\CategoryController;
|
||||||
|
use App\Http\Controllers\Admin\Master\CustomerController;
|
||||||
|
use App\Http\Controllers\Admin\Master\SupplierController;
|
||||||
use App\Http\Controllers\Admin\RoleController;
|
use App\Http\Controllers\Admin\RoleController;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
use App\Enums\PayrollPeriodStatus;
|
use App\Enums\PayrollPeriodStatus;
|
||||||
use App\Enums\PayrollStatus;
|
use App\Enums\PayrollStatus;
|
||||||
use App\Models\CashAccount;
|
use App\Models\CashAccount;
|
||||||
use App\Models\CashTransaction;
|
|
||||||
use App\Models\Employee;
|
use App\Models\Employee;
|
||||||
use App\Models\Payroll;
|
use App\Models\Payroll;
|
||||||
use App\Models\PayrollAdjustment;
|
use App\Models\PayrollAdjustment;
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Models\Employee;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Models\UserProfile;
|
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
use Inertia\Testing\AssertableInertia as Assert;
|
use Inertia\Testing\AssertableInertia as Assert;
|
||||||
|
|
||||||
|
|||||||
@ -1702,7 +1702,7 @@
|
|||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
$this->actingAs($user);
|
$this->actingAs($user);
|
||||||
|
|
||||||
$response = $this->post(route('admin.master.categories.store'), ['name' => "ABCDE"]);
|
$response = $this->post(route('admin.master.categories.store'), ['name' => 'ABCDE']);
|
||||||
$response->assertSessionHasNoErrors();
|
$response->assertSessionHasNoErrors();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1710,7 +1710,7 @@
|
|||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
$this->actingAs($user);
|
$this->actingAs($user);
|
||||||
|
|
||||||
$response = $this->post(route('admin.master.categories.store'), ['name' => "()【】"]);
|
$response = $this->post(route('admin.master.categories.store'), ['name' => '()【】']);
|
||||||
$response->assertSessionHasNoErrors();
|
$response->assertSessionHasNoErrors();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Models\Purchase;
|
|
||||||
use App\Models\Customer;
|
use App\Models\Customer;
|
||||||
|
use App\Models\Purchase;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
use Inertia\Testing\AssertableInertia as Assert;
|
use Inertia\Testing\AssertableInertia as Assert;
|
||||||
@ -1675,7 +1675,7 @@
|
|||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
$this->actingAs($user);
|
$this->actingAs($user);
|
||||||
|
|
||||||
$response = $this->post(route('admin.master.customers.store'), ['name' => "ABCDE"]);
|
$response = $this->post(route('admin.master.customers.store'), ['name' => 'ABCDE']);
|
||||||
$response->assertSessionHasNoErrors();
|
$response->assertSessionHasNoErrors();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1683,7 +1683,7 @@
|
|||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
$this->actingAs($user);
|
$this->actingAs($user);
|
||||||
|
|
||||||
$response = $this->post(route('admin.master.customers.store'), ['name' => "()【】"]);
|
$response = $this->post(route('admin.master.customers.store'), ['name' => '()【】']);
|
||||||
$response->assertSessionHasNoErrors();
|
$response->assertSessionHasNoErrors();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1786,14 +1786,14 @@
|
|||||||
|
|
||||||
foreach ($phones as $phone) {
|
foreach ($phones as $phone) {
|
||||||
$response = $this->post(route('admin.master.customers.store'), [
|
$response = $this->post(route('admin.master.customers.store'), [
|
||||||
'name' => 'Customer ' . $phone,
|
'name' => 'Customer '.$phone,
|
||||||
'phone_number' => $phone,
|
'phone_number' => $phone,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$response->assertSessionHasNoErrors();
|
$response->assertSessionHasNoErrors();
|
||||||
|
|
||||||
$this->assertDatabaseHas('customers', [
|
$this->assertDatabaseHas('customers', [
|
||||||
'name' => 'Customer ' . $phone,
|
'name' => 'Customer '.$phone,
|
||||||
'phone_number' => $phone,
|
'phone_number' => $phone,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1675,7 +1675,7 @@
|
|||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
$this->actingAs($user);
|
$this->actingAs($user);
|
||||||
|
|
||||||
$response = $this->post(route('admin.master.suppliers.store'), ['name' => "ABCDE"]);
|
$response = $this->post(route('admin.master.suppliers.store'), ['name' => 'ABCDE']);
|
||||||
$response->assertSessionHasNoErrors();
|
$response->assertSessionHasNoErrors();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1683,7 +1683,7 @@
|
|||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
$this->actingAs($user);
|
$this->actingAs($user);
|
||||||
|
|
||||||
$response = $this->post(route('admin.master.suppliers.store'), ['name' => "()【】"]);
|
$response = $this->post(route('admin.master.suppliers.store'), ['name' => '()【】']);
|
||||||
$response->assertSessionHasNoErrors();
|
$response->assertSessionHasNoErrors();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1786,14 +1786,14 @@
|
|||||||
|
|
||||||
foreach ($phones as $phone) {
|
foreach ($phones as $phone) {
|
||||||
$response = $this->post(route('admin.master.suppliers.store'), [
|
$response = $this->post(route('admin.master.suppliers.store'), [
|
||||||
'name' => 'Supplier ' . $phone,
|
'name' => 'Supplier '.$phone,
|
||||||
'phone_number' => $phone,
|
'phone_number' => $phone,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$response->assertSessionHasNoErrors();
|
$response->assertSessionHasNoErrors();
|
||||||
|
|
||||||
$this->assertDatabaseHas('suppliers', [
|
$this->assertDatabaseHas('suppliers', [
|
||||||
'name' => 'Supplier ' . $phone,
|
'name' => 'Supplier '.$phone,
|
||||||
'phone_number' => $phone,
|
'phone_number' => $phone,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Settings\HRSettings;
|
|
||||||
use App\Settings\HomepageSettings;
|
use App\Settings\HomepageSettings;
|
||||||
|
use App\Settings\HRSettings;
|
||||||
use App\Settings\MarketplaceSettings;
|
use App\Settings\MarketplaceSettings;
|
||||||
use App\Settings\SocialMediaSettings;
|
use App\Settings\SocialMediaSettings;
|
||||||
use App\Settings\SystemSettings;
|
use App\Settings\SystemSettings;
|
||||||
|
|||||||
@ -5,11 +5,12 @@
|
|||||||
use Inertia\Testing\AssertableInertia as Assert;
|
use Inertia\Testing\AssertableInertia as Assert;
|
||||||
use Spatie\Permission\Models\Permission;
|
use Spatie\Permission\Models\Permission;
|
||||||
use Spatie\Permission\Models\Role;
|
use Spatie\Permission\Models\Role;
|
||||||
|
use Spatie\Permission\PermissionRegistrar;
|
||||||
|
|
||||||
uses(RefreshDatabase::class);
|
uses(RefreshDatabase::class);
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
|
app()[PermissionRegistrar::class]->forgetCachedPermissions();
|
||||||
|
|
||||||
$modules = [
|
$modules = [
|
||||||
'user' => ['view', 'create', 'update', 'delete', 'toggle-active', 'reset-password'],
|
'user' => ['view', 'create', 'update', 'delete', 'toggle-active', 'reset-password'],
|
||||||
|
|||||||
@ -275,7 +275,7 @@
|
|||||||
$response = $this
|
$response = $this
|
||||||
->actingAs($user)
|
->actingAs($user)
|
||||||
->patch(route('profile.update'), [
|
->patch(route('profile.update'), [
|
||||||
'email' => str_repeat('a', 246) . '@example.com',
|
'email' => str_repeat('a', 246).'@example.com',
|
||||||
'username' => 'emailmax',
|
'username' => 'emailmax',
|
||||||
'full_name' => 'Test',
|
'full_name' => 'Test',
|
||||||
]);
|
]);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user