Add key for activities
This commit is contained in:
parent
1dddc6d103
commit
ad5b185c7c
2 changed files with 6 additions and 0 deletions
|
|
@ -83,6 +83,11 @@ class Activity extends Eloquent
|
|||
return $this->belongsTo('App\Models\Task')->withTrashed();
|
||||
}
|
||||
|
||||
public function key()
|
||||
{
|
||||
return sprintf('%s-%s-%s', $this->activity_type_id, $this->client_id, $this->created_at->timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ class ActivityTransformer extends EntityTransformer
|
|||
public function transform(Activity $activity)
|
||||
{
|
||||
return [
|
||||
'id' => $activity->key(),
|
||||
'activity_type_id' => $activity->activity_type_id,
|
||||
'client_id' => $activity->client->public_id,
|
||||
'user_id' => $activity->user->public_id + 1,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue