pxlrbt / filament-activity-log

Spatie activity log integration into Filament
MIT License
126 stars 24 forks source link

What if i want all the Logs at Once #5

Closed GHOST117s closed 1 year ago

GHOST117s commented 1 year ago

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;

}
pxlrbt commented 1 year ago

What do you mean by "all the logs at once"? No Pagination?

GHOST117s commented 1 year ago

What do you mean by "all the logs at once"? No Pagination?

I mean that using this example -- if you have a user, if u edit that user you have to go to that particular user to see the logs right

I want that without going to that particular user can i get all the user logs in one place

plz see the video

https://drive.google.com/file/d/1VkJTw0vF6YDfyS0-dSoIraCzY-JVBLT7/view?usp=sharing

pxlrbt commented 1 year ago

I think there are other Filament plugins that do this. Check the Plugins page. I think a global log get crowded quite fast, that's why I built it this way.

GHOST117s commented 1 year ago

I think there are other Filament plugins that do this. Check the Plugins page. I think a global log get crowded quite fast, that's why I built it this way.

can U suggest one plugin? that can do that

pxlrbt commented 1 year ago

https://filamentphp.com/plugins/logger https://filamentphp.com/plugins/spatie-activity-log

GHOST117s commented 1 year ago

https://filamentphp.com/plugins/logger https://filamentphp.com/plugins/spatie-activity-log

Thanxxxxxxx for helping me out