feat: integrate Spatie Activitylog for activity tracking across models
- Added activity logging functionality to multiple models including CuttingMaterial, Employee, Invoice, and more. - Implemented `getActivitylogOptions` method to configure logging behavior. - Updated composer dependencies to include `spatie/laravel-activitylog`. - Created a custom Activity model extending Spatie's Activity model. - Added configuration file for activity logging settings.
This commit is contained in:
parent
76f49e74f5
commit
91913633de
10
app/Models/Activity.php
Normal file
10
app/Models/Activity.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Spatie\Activitylog\Models\Activity as SpatieActivity;
|
||||
|
||||
class Activity extends SpatieActivity
|
||||
{
|
||||
protected $table = 'activity_log';
|
||||
}
|
||||
@ -8,12 +8,14 @@
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_read_at'])]
|
||||
#[Guarded(['id'])]
|
||||
class AppNotification extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasFactory, LogsActivity;
|
||||
|
||||
protected $table = 'notifications';
|
||||
|
||||
@ -25,6 +27,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedReadAt(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -12,13 +12,15 @@
|
||||
use Spatie\Image\Enums\Fit;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
|
||||
#[Appends(['formatted_attendance_date', 'formatted_check_in_at', 'formatted_check_out_at'])]
|
||||
#[Guarded(['id'])]
|
||||
class Attendance extends Model implements HasMedia
|
||||
{
|
||||
use HasFactory, InteractsWithMedia;
|
||||
use HasFactory, InteractsWithMedia, LogsActivity;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -34,6 +36,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedAttendanceDate(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -10,12 +10,14 @@
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_balance', 'formatted_name'])]
|
||||
#[Guarded(['id'])]
|
||||
class CashAccount extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -24,6 +26,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedBalance(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -18,13 +18,15 @@
|
||||
use Spatie\Image\Enums\Fit;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
|
||||
#[Appends(['formatted_amount', 'formatted_balance_after', 'formatted_created_at', 'type_label'])]
|
||||
#[Guarded(['id'])]
|
||||
class CashTransaction extends Model implements HasMedia
|
||||
{
|
||||
use HasFactory, InteractsWithMedia, SoftDeletes;
|
||||
use HasFactory, InteractsWithMedia, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -35,6 +37,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedAmount(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
use Spatie\Sluggable\Attributes\Sluggable;
|
||||
|
||||
#[Appends(['formatted_name'])]
|
||||
@ -16,7 +18,15 @@
|
||||
#[Sluggable(from: 'name', to: 'slug')]
|
||||
class Category extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedName(): Attribute
|
||||
{
|
||||
|
||||
@ -9,12 +9,22 @@
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_name', 'formatted_phone_number'])]
|
||||
#[Guarded(['id'])]
|
||||
class Customer extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedName(): Attribute
|
||||
{
|
||||
|
||||
@ -16,13 +16,15 @@
|
||||
use Spatie\Image\Enums\Fit;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
|
||||
#[Appends(['formatted_cost_per_unit', 'status_label', 'formatted_total_material_cost', 'formatted_created_at'])]
|
||||
#[Guarded(['id'])]
|
||||
class Cutting extends Model implements HasMedia
|
||||
{
|
||||
use HasFactory, InteractsWithMedia, SoftDeletes;
|
||||
use HasFactory, InteractsWithMedia, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -33,6 +35,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedCostPerUnit(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -9,12 +9,14 @@
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_material_result', 'formatted_material_usage'])]
|
||||
#[Guarded(['id'])]
|
||||
class CuttingMaterial extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -24,6 +26,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedMaterialResult(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -10,12 +10,14 @@
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_material_result'])]
|
||||
#[Guarded(['id'])]
|
||||
class CuttingMaterialCombination extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -24,6 +26,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedMaterialResult(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -9,12 +9,14 @@
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_cutting_result', 'formatted_original_outside_sample', 'formatted_sample'])]
|
||||
#[Guarded(['id'])]
|
||||
class CuttingResult extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -25,6 +27,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedCuttingResult(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -13,12 +13,14 @@
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_base_salary', 'employment_status_label', 'formatted_join_date', 'formatted_resign_date'])]
|
||||
#[Guarded(['id'])]
|
||||
class Employee extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -30,6 +32,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedBaseSalary(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -13,12 +13,14 @@
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_amount', 'formatted_created_at', 'formatted_due_date', 'formatted_paid_amount', 'formatted_remaining_amount', 'status_label'])]
|
||||
#[Guarded(['id'])]
|
||||
class EmployeeAdvance extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -32,6 +34,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedAmount(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -8,12 +8,14 @@
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_amount', 'formatted_paid_at'])]
|
||||
#[Guarded(['id'])]
|
||||
class EmployeeAdvancePayment extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasFactory, LogsActivity;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -23,6 +25,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedAmount(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -12,13 +12,15 @@
|
||||
use Spatie\Image\Enums\Fit;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
|
||||
#[Appends(['formatted_amount', 'formatted_created_at', 'formatted_date'])]
|
||||
#[Guarded(['id'])]
|
||||
class Expense extends Model implements HasMedia
|
||||
{
|
||||
use HasFactory, InteractsWithMedia, SoftDeletes;
|
||||
use HasFactory, InteractsWithMedia, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -28,6 +30,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedAmount(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -5,9 +5,19 @@
|
||||
use Illuminate\Database\Eloquent\Attributes\Guarded;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Guarded(['id'])]
|
||||
class HomepageConfiguration extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasFactory, LogsActivity;
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,12 +10,14 @@
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_amount', 'formatted_date', 'formatted_due_date', 'status_label'])]
|
||||
#[Guarded(['id'])]
|
||||
class Invoice extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -27,6 +29,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedAmount(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -5,10 +5,14 @@
|
||||
use Illuminate\Database\Eloquent\Attributes\Guarded;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Guarded(['id'])]
|
||||
class InvoiceItem extends Model
|
||||
{
|
||||
use LogsActivity;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
@ -18,6 +22,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
public function invoice(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Invoice::class);
|
||||
|
||||
@ -12,12 +12,14 @@
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_end_date', 'formatted_start_date', 'status_label'])]
|
||||
#[Guarded(['id'])]
|
||||
class LeaveRequest extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -30,6 +32,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedEndDate(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -17,6 +17,8 @@
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Image\Enums\Fit;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
@ -25,7 +27,7 @@
|
||||
#[Guarded(['id'])]
|
||||
class Order extends Model implements HasMedia
|
||||
{
|
||||
use HasFactory, InteractsWithMedia, SoftDeletes;
|
||||
use HasFactory, InteractsWithMedia, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -42,6 +44,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function channelLabel(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -12,12 +12,14 @@
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['stock_quality_label', 'formatted_subtotal', 'formatted_unit_price'])]
|
||||
#[Guarded(['id'])]
|
||||
class OrderItem extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -29,6 +31,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function stockQualityLabel(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -13,12 +13,14 @@
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_base_salary', 'formatted_bonus_amount', 'formatted_deduction_amount', 'status_label', 'formatted_total_amount'])]
|
||||
#[Guarded(['id'])]
|
||||
class Payroll extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -32,6 +34,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedBaseSalary(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -12,12 +12,14 @@
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_amount', 'type_label'])]
|
||||
#[Guarded(['id'])]
|
||||
class PayrollAdjustment extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -27,6 +29,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedAmount(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -14,12 +14,14 @@
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_closed_at', 'month_name', 'status_label'])]
|
||||
#[Guarded(['id'])]
|
||||
class PayrollPeriod extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -31,6 +33,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedClosedAt(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -13,6 +13,8 @@
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
use Spatie\Sluggable\Attributes\Sluggable;
|
||||
|
||||
#[Appends(['formatted_name', 'status_label'])]
|
||||
@ -20,7 +22,7 @@
|
||||
#[Sluggable(from: 'name', to: 'slug')]
|
||||
class Product extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -30,6 +32,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedName(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -11,12 +11,14 @@
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_price', 'type_label'])]
|
||||
#[Guarded(['id'])]
|
||||
class ProductPrice extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasFactory, LogsActivity;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -26,6 +28,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedPrice(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -12,6 +12,8 @@
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
use Spatie\Image\Enums\Fit;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
@ -22,7 +24,7 @@
|
||||
#[ScopedBy([ProductVariantScope::class])]
|
||||
class ProductVariant extends Model implements HasMedia
|
||||
{
|
||||
use HasFactory, InteractsWithMedia, SoftDeletes;
|
||||
use HasFactory, InteractsWithMedia, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -33,6 +35,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedName(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -13,13 +13,15 @@
|
||||
use Spatie\Image\Enums\Fit;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
|
||||
#[Appends(['formatted_discount', 'formatted_shipping_cost', 'formatted_subtotal', 'formatted_total'])]
|
||||
#[Guarded(['id'])]
|
||||
class Purchase extends Model implements HasMedia
|
||||
{
|
||||
use HasFactory, InteractsWithMedia, SoftDeletes;
|
||||
use HasFactory, InteractsWithMedia, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -31,6 +33,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedDiscount(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -9,12 +9,14 @@
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_subtotal', 'formatted_unit_price'])]
|
||||
#[Guarded(['id'])]
|
||||
class PurchaseItem extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -25,6 +27,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedSubtotal(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -6,11 +6,21 @@
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Guarded(['id'])]
|
||||
class PushSubscription extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasFactory, LogsActivity;
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
public function user(): MorphTo
|
||||
{
|
||||
|
||||
@ -12,12 +12,14 @@
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_name', 'unit_label'])]
|
||||
#[Guarded(['id'])]
|
||||
class RawMaterial extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -27,6 +29,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedName(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
use Spatie\Image\Enums\Fit;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
|
||||
#[Appends(['formatted_price', 'formatted_stock'])]
|
||||
@ -23,7 +25,7 @@
|
||||
#[ScopedBy([RawMaterialPriceScope::class])]
|
||||
class RawMaterialPrice extends Model implements HasMedia
|
||||
{
|
||||
use HasFactory, InteractsWithMedia, SoftDeletes;
|
||||
use HasFactory, InteractsWithMedia, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -33,6 +35,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedPrice(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -8,11 +8,21 @@
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Guarded(['id'])]
|
||||
class Rejection extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
public function rejectable(): MorphTo
|
||||
{
|
||||
|
||||
@ -16,13 +16,15 @@
|
||||
use Spatie\Image\Enums\Fit;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
|
||||
#[Appends(['stock_type_label', 'formatted_total'])]
|
||||
#[Guarded(['id'])]
|
||||
class Restock extends Model implements HasMedia
|
||||
{
|
||||
use HasFactory, InteractsWithMedia, SoftDeletes;
|
||||
use HasFactory, InteractsWithMedia, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -32,6 +34,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function stockTypeLabel(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -9,12 +9,14 @@
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_subtotal', 'formatted_unit_price'])]
|
||||
#[Guarded(['id'])]
|
||||
class RestockItem extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -25,6 +27,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedSubtotal(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -8,12 +8,14 @@
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_quantity', 'formatted_retail_stock_before', 'formatted_retail_stock_after', 'formatted_stock_before', 'formatted_stock_after'])]
|
||||
#[Guarded(['id'])]
|
||||
class RetailStockHistory extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasFactory, LogsActivity;
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
@ -28,6 +30,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedQuantity(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -9,12 +9,14 @@
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_quantity', 'formatted_stock_after', 'formatted_stock_before'])]
|
||||
#[Guarded(['id'])]
|
||||
class StockMutation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasFactory, LogsActivity;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -25,6 +27,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedQuantity(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -13,12 +13,14 @@
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_opname_date', 'status_label'])]
|
||||
#[Guarded(['id'])]
|
||||
class StokOpname extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -28,6 +30,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedOpnameDate(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -11,12 +11,14 @@
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['stock_quality_label'])]
|
||||
#[Guarded(['id'])]
|
||||
class StokOpnameItem extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasFactory, LogsActivity;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -28,6 +30,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function stockQualityLabel(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -9,12 +9,22 @@
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_name', 'formatted_phone_number'])]
|
||||
#[Guarded(['id'])]
|
||||
class Supplier extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedName(): Attribute
|
||||
{
|
||||
|
||||
@ -5,9 +5,19 @@
|
||||
use Illuminate\Database\Eloquent\Attributes\Guarded;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Guarded(['id'])]
|
||||
class SystemConfiguration extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasFactory, LogsActivity;
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,13 +20,15 @@
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
#[Appends(['avatar', 'full_name', 'name'])]
|
||||
#[Guarded(['id'])]
|
||||
class User extends Authenticatable implements HasMedia
|
||||
{
|
||||
use HasFactory, HasPushSubscriptions, HasRoles, InteractsWithMedia, Notifiable, SoftDeletes, TwoFactorAuthenticatable;
|
||||
use HasFactory, HasPushSubscriptions, HasRoles, InteractsWithMedia, LogsActivity, Notifiable, SoftDeletes, TwoFactorAuthenticatable;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -39,6 +41,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function email(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -12,12 +12,14 @@
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
|
||||
#[Appends(['formatted_birth_date', 'gender_label', 'formatted_phone_number'])]
|
||||
#[Guarded(['id'])]
|
||||
class UserProfile extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
@ -27,6 +29,14 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges();
|
||||
}
|
||||
|
||||
protected function formattedBirthDate(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
"laravel/tinker": "^3.0",
|
||||
"laravel/wayfinder": "^0.1.14",
|
||||
"league/flysystem-aws-s3-v3": "^3.0",
|
||||
"spatie/laravel-activitylog": "^5.1",
|
||||
"spatie/laravel-data": "^4.23",
|
||||
"spatie/laravel-medialibrary": "^11.23",
|
||||
"spatie/laravel-permission": "^8.3",
|
||||
|
||||
95
composer.lock
generated
95
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "c8587897f88cd85097351d4f9acdd0bd",
|
||||
"content-hash": "9a292d645fabd96d291aaa30d8aa8112",
|
||||
"packages": [
|
||||
{
|
||||
"name": "aws/aws-crt-php",
|
||||
@ -4816,6 +4816,99 @@
|
||||
},
|
||||
"time": "2026-06-29T08:28:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/laravel-activitylog",
|
||||
"version": "5.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/spatie/laravel-activitylog.git",
|
||||
"reference": "97c9f7e82033b18dc9db25de276f9b71e01449ea"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/spatie/laravel-activitylog/zipball/97c9f7e82033b18dc9db25de276f9b71e01449ea",
|
||||
"reference": "97c9f7e82033b18dc9db25de276f9b71e01449ea",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/config": "^13.0",
|
||||
"illuminate/database": "^13.0",
|
||||
"illuminate/support": "^13.0",
|
||||
"php": "^8.4",
|
||||
"spatie/laravel-package-tools": "^1.6.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-json": "*",
|
||||
"larastan/larastan": "^3.0",
|
||||
"laravel/pint": "^1.29",
|
||||
"orchestra/testbench": "^11.0",
|
||||
"pestphp/pest": "^5.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Spatie\\Activitylog\\ActivitylogServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/helpers.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Spatie\\Activitylog\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Freek Van der Herten",
|
||||
"email": "freek@spatie.be",
|
||||
"homepage": "https://spatie.be",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian De Deyne",
|
||||
"email": "sebastian@spatie.be",
|
||||
"homepage": "https://spatie.be",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "Tom Witkowski",
|
||||
"email": "dev.gummibeer@gmail.com",
|
||||
"homepage": "https://gummibeer.de",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "A very simple activity logger to monitor the users of your website or application",
|
||||
"homepage": "https://github.com/spatie/laravel-activitylog",
|
||||
"keywords": [
|
||||
"activity",
|
||||
"laravel",
|
||||
"log",
|
||||
"spatie",
|
||||
"user"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/spatie/laravel-activitylog/issues",
|
||||
"source": "https://github.com/spatie/laravel-activitylog/tree/5.1.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://spatie.be/open-source/support-us",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/spatie",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2026-08-12T12:07:38+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/laravel-data",
|
||||
"version": "4.23.0",
|
||||
|
||||
73
config/activitylog.php
Normal file
73
config/activitylog.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
use Spatie\Activitylog\Actions\CleanActivityLogAction;
|
||||
use Spatie\Activitylog\Actions\LogActivityAction;
|
||||
use Spatie\Activitylog\Models\Activity;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
* If set to false, no activities will be saved to the database.
|
||||
*/
|
||||
'enabled' => env('ACTIVITYLOG_ENABLED', true),
|
||||
|
||||
/*
|
||||
* When the clean command is executed, all recording activities older than
|
||||
* the number of days specified here will be deleted.
|
||||
*/
|
||||
'clean_after_days' => 365,
|
||||
|
||||
/*
|
||||
* If no log name is passed to the activity() helper
|
||||
* we use this default log name.
|
||||
*/
|
||||
'default_log_name' => 'default',
|
||||
|
||||
/*
|
||||
* You can specify an auth driver here that gets user models.
|
||||
* If this is null we'll use the current Laravel auth driver.
|
||||
*/
|
||||
'default_auth_driver' => null,
|
||||
|
||||
/*
|
||||
* If set to true, the subject relationship on activities
|
||||
* will include soft deleted models.
|
||||
*/
|
||||
'include_soft_deleted_subjects' => false,
|
||||
|
||||
/*
|
||||
* This model will be used to log activity.
|
||||
* It should implement the Spatie\Activitylog\Contracts\Activity interface
|
||||
* and extend Illuminate\Database\Eloquent\Model.
|
||||
*/
|
||||
'activity_model' => \App\Models\Activity::class,
|
||||
|
||||
/*
|
||||
* These attributes will be excluded from logging for all models.
|
||||
* Model-specific exclusions via logExcept() are merged with these.
|
||||
*/
|
||||
'default_except_attributes' => [],
|
||||
|
||||
/*
|
||||
* When enabled, activities are buffered in memory and inserted in a
|
||||
* single bulk query after the response has been sent to the client.
|
||||
* This can significantly reduce the number of database queries when
|
||||
* many activities are logged during a single request.
|
||||
*
|
||||
* Only enable this if your application logs a high volume of activities
|
||||
* per request. Buffered activities will not have an ID until the
|
||||
* buffer is flushed.
|
||||
*/
|
||||
'buffer' => [
|
||||
'enabled' => env('ACTIVITYLOG_BUFFER_ENABLED', false),
|
||||
],
|
||||
|
||||
/*
|
||||
* These action classes can be overridden to customize how activities
|
||||
* are logged and cleaned. Your custom classes must extend the originals.
|
||||
*/
|
||||
'actions' => [
|
||||
'log_activity' => LogActivityAction::class,
|
||||
'clean_log' => CleanActivityLogAction::class,
|
||||
],
|
||||
];
|
||||
Loading…
Reference in New Issue
Block a user