spatie / laravel-activitylog

Log activity inside your Laravel app

Home Page:https://docs.spatie.be/laravel-activitylog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

after install the package, unable to use the feature at volt component

alexteh opened this issue · comments

Describe the bug
after install the package, unable to use the feature at volt component
use Spatie\Activitylog\Models\Activity;

{{ activity()->log('Look mum, I logged something'); }}

To Reproduce
after install the package, use the feature at volt component
use Spatie\Activitylog\Models\Activity;

{{ activity()->log('Look mum, I logged something'); }}

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions (please complete the following information)

  • PHP: 8.3.6
  • Database:mariadb
  • Laravel: 11
  • Package: "spatie/laravel-activitylog": "dev-main"

Exception
insert into activity_log (log_name, properties, causer_id, causer_type, batch_uuid, description, updated_at, created_at) values (default, [], 9c102677-c810-4d0f-a09c-5dd3ea428ac8, App\Models\User, ?, Look mum, I logged something, 2024-05-17 07:51:55, 2024-05-17 07:51:55)

Stack Trace
insert into activity_log (log_name, properties, causer_id, causer_type, batch_uuid, description, updated_at, created_at) values (default, [], 9c102677-c810-4d0f-a09c-5dd3ea428ac8, App\Models\User, ?, Look mum, I logged something, 2024-05-17 07:51:55, 2024-05-17 07:51:55)

image
image

found the root cause, the initial setup with the migration file given, causer_id is using unsigned bigint instead of UUID, where as the the User id currently im using is uuid. any solution to patch this for UUID's implementation?

Not sure if this is the correct way, but the only thing i could think of is as soon as I require and publish the package, straightaway change this:

// from this:
$table->nullableMorphs('subject', 'subject');
$table->nullableMorphs('causer', 'causer');

// to this:
$table->nullableUuidMorphs('subject', 'subject');
$table->nullableUuidMorphs('causer', 'causer');

image