Laravel-auditing: How logs with model belongsToMany

Created on 23 Aug 2016  路  4Comments  路  Source: owen-it/laravel-auditing

This is my model, I want to log table user_group and role_group. Example: Assign a role to group or assign a user to group.
How do you do?
Thanks
Vinh
` namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use \OwenIt\Auditing\Auditing;

class Group extends Auditing
{
// use Auditing;

/**
 * The attributes that are mass assignable.
 *
 * @var array
 */
protected $fillable = array('name', 'description');



/**
 * Get all of the users for the group.
 */
public function users()
{
    return $this->belongsToMany(\App\User::class, 'user_group');
}

/**
 * Get all of the roles for the group.
 */
public function roles()
{
    return $this->belongsToMany(Role::class, 'role_group');
}

}
`

Most helpful comment

All 4 comments

Hi @tonvinh ,

I did not forget this improvements will soon be available.

I am looking forward to this feature as well. It is something I really would like to see available, as none of the other solutions for history/auditing have it available.

I have not had much time, but whenever possible I have thought of something.

This feature depends largely on the framework.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

franciscojun picture franciscojun  路  8Comments

riazXrazor picture riazXrazor  路  3Comments

donaldtbd picture donaldtbd  路  3Comments

JeffBeltran picture JeffBeltran  路  3Comments

wyred picture wyred  路  7Comments