GithubHelp home page GithubHelp logo

pxlrbt / filament-activity-log Goto Github PK

View Code? Open in Web Editor NEW
118.0 3.0 23.0 426 KB

Spatie activity log integration into Filament

License: MIT License

PHP 64.75% Blade 35.25%
filamentadmin filamentphp laravel

filament-activity-log's People

Contributors

aaronlei avatar aslanutku avatar egyweb-mohamed avatar fabianpnke avatar fabpl avatar idiegonl avatar jvitasek avatar lakuapik avatar miguelurtado avatar mohamedsabil83 avatar niekbr avatar pxlrbt avatar rawand201 avatar saifallak avatar simonbroekaert avatar tonypartridge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

filament-activity-log's Issues

Support for array type property

Hi

If my model has a property casted to array the view cannot print changes

htmlspecialchars(): Argument #1 ($string) must be of type string, array given

in

{{ data_get($changes, "attributes.{$field}") }}

my property in activity_log is this

{
    "attributes": {
        "number": "23080827832",
        "service": "multi",
        "type": "s",
        "date_issued": "2023-01-18",
        "date_expiration": "2023-02-09",
        "status": 4,
        "status_updated_at": "2023-05-30T10:18:44.000000Z",
        "supplier_sfid": "0011i00000KFLiiAAH",
        "customer_sfid": "0016N00000cuRhOQAU",
        "consumptions": {
            "gn": 170,
            "ee": 262
        },
        "amounts": {
            "gn": 236.95,
            "ee": 122.27
        },
        "fattura_sfid": {
            "ee": "a036N00000ABhMAQA1",
            "gn": "a036N00000ABhM6QAL"
        },
        "ranking": 30,
        "home_sfid": null
    },
    "old": {
        "number": "2308082783",
        "service": "multi",
        "type": "ds",
        "date_issued": "2023-01-18",
        "date_expiration": "2023-02-09",
        "status": 4,
        "status_updated_at": "2023-05-30T10:18:44.000000Z",
        "supplier_sfid": "0011i00000KFLiiAAH",
        "customer_sfid": "0016N00000cuRhOQAU",
        "consumptions": {
            "gn": 170,
            "ee": 262
        },
        "amounts": {
            "gn": 236.95,
            "ee": 122.27
        },
        "fattura_sfid": {
            "ee": "a036N00000ABhMAQA1",
            "gn": "a036N00000ABhM6QAL"
        },
        "ranking": 0,
        "home_sfid": "a116N000004LMnLQAW"
    }
}

Illegal Offset type

Hello Dennis,

I would like to use your filament package, but have some troubles to get it running.
I get always a illegal offset type from the table action and i tried so much different things. Maybe you can give me a hint.

I created a page inside my filament resource folder called "ListStopActivities.php"

<?php

namespace App\Filament\Resources\StopResource\Pages;

use App\Filament\Resources\StopResource;
use pxlrbt\FilamentActivityLog\Pages\ListActivities;

class ListStopActivities extends ListActivities
{
    protected static string $resource = StopResource::class;

}

Afterwards i added the page to the getPages method:

public static function getPages(): array
    {
        return [
            'index' => Pages\ListStops::route('/'),
            'create' => Pages\CreateStop::route('/create'),
            'edit' => Pages\EditStop::route('/{record}/edit'),
            'activities' => Pages\ListStopActivities::route('/{record}/activities'),
        ];
    }

And last i added the action to the table action array.

->actions([
                Tables\Actions\EditAction::make(),
                Tables\Actions\DeleteAction::make(),
                Tables\Actions\Action::make('activities')->url(fn ($record) => StopResource::getUrl('activities', [$record => $record])),
            ])

Maybe you have a hint?
Thanks, Armin

Restore doesn't do anything

There are no requests being made to the server, and so no reversion is actually done when clicking the button.

Have tested this numerous times across a bunch of resources.

[Feature] - Restore

Current contemplating in the future building a restore feature to the activities so a user can restore the old values back should they wish, limited to the properties column of course.

What if i want all the Logs at Once

this is my Model what if I want all the logs at Once

`<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

use Spatie\Activitylog\Traits\LogsActivity;
use Spatie\Activitylog\LogOptions;

class MfmUser extends Model
{
    use HasFactory, SoftDeletes, LogsActivity;


    protected $fillable = [
        'companyId',
        'firstName',
        'lastName',
        'email',
        'password',
        'phone',
        'type',
        'role',
        'locationIds',
        'profilePhoto',
        'mfm_userId',
    ];
    public function permissions()
    {
        return $this->belongsTo(Permission::class, 'permissions_id');
    }

    public function contactTask()
    {
        return $this->hasOne(ContactTasks::class);
    }

    public function contactNote()
    {
        return $this->hasOne(ContactNote::class);
    }
    public function getActivitylogOptions(): LogOptions
    {
        return LogOptions::defaults()
            ->logOnly([
                'companyId', 'firstName', 'lastName', 'email', 'password','phone','type','role', 'locationIds','',
            ]) // Customize the fields to log
            ->logOnlyDirty()
            ->useLogName('mfm_user_log'); 
    }
}
`

this is my custom page

<?php

namespace App\Filament\Resources\MfmUserResource\Pages;

use pxlrbt\FilamentActivityLog\Pages\ListActivities;
use App\Filament\Resources\MfmUserResource;

class ListMfmUsersActivities extends ListActivities
{
    protected static string $resource = MfmUserResource::class;
    
}


Action isn't being passed the record object

After following the steps, seeing this error when listing users:

Missing required parameter for [Route: filament.admin.resources.users.activities] [URI: admin/users/{record}/activities] [Missing parameter: record].

Call to undefined method App\Models\User::activities()

I always get this error message. I have created the ListUserActivities under Filament\Resource\UserResource\Pages. In the UserResource I registered the page and added an action to the table. I see the Activities link next to each user but when I click on it, I always get the Call to undefined method App\Models\User::activities() error.

Support custom event log

HI, would be great if it can display custom events, the this in spatie/laravel-activitylog doc

activity()
   ->performedOn($anEloquentModel)
   ->causedBy($user)
   ->withProperties(['customProperty' => 'customValue'])
   ->log('Look mum, I logged something');

Navigation: Table/Record page action to access activities page

๐Ÿ‘‹ Heyo. Neat package!

I've followed the installation instructions and I've noticed there is no direct way to navigate to a given user/model's activities other than directly going to /{record}/activities. Am I missing something, or would it be good to have actions to access activities from the List and View pages?

I can have a crack at it over the weekend, but wanted to highlight it for now.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.