Skip to content

Commit

Permalink
Add username configuration option
Browse files Browse the repository at this point in the history
  • Loading branch information
antonioribeiro committed Jul 2, 2014
1 parent 6b58cef commit df9bef5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/Vendor/Laravel/Controllers/Stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ public function users()
{
return View::make('pragmarx/tracker::users')
->with('users', Tracker::users(60 * 24 * Session::get('tracker.stats.days')))
->with('title', 'Users');
->with('title', 'Users')
->with('username_column', Tracker::getConfig('authenticated_user_username_column'));
}

private function events()
Expand Down
2 changes: 2 additions & 0 deletions src/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@

'authenticated_user_id_column' => 'id', // to Auth::user()->id

'authenticated_user_username_column' => 'email', // to Auth::user()->email

/**
* Laravel Alias, create one? Which name?
*/
Expand Down
4 changes: 2 additions & 2 deletions src/views/users.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
<table class="table table-striped">
<thead>
<tr>
<th>Email</th>
<th>{{ studly($username_column) }}</th>
<th>Last seen</th>
</tr>
</thead>

<tbody>
@foreach($users as $user)
<tr>
<td>{{ $user->user->email }}</td>
<td>{{ $user->user->$username_column }}</td>
<td>{{ $user->updated_at->diffForHumans() }}</td>
</tr>
@endforeach
Expand Down
18 changes: 14 additions & 4 deletions upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,21 @@

## to 0.5.1

As `tracker_route_paths.route_id` column was wrongly set to string, you need to change it to int8 or bigint. This is how you do this in PostgreSQL:
####As `tracker_route_paths.route_id` column was wrongly set to string, you need to change it to int8 or bigint. This is how you do this in PostgreSQL:

ALTER TABLE "tracker_route_paths"
ALTER COLUMN route_id TYPE bigint
USING CAST(CASE route_id WHEN '' THEN NULL ELSE route_id END AS INTEGER)
```
ALTER TABLE "tracker_route_paths"
ALTER COLUMN route_id TYPE bigint
USING CAST(CASE route_id WHEN '' THEN NULL ELSE route_id END AS INTEGER)
```

####Add the following keys to your `app/config/packages/pragmarx/tracker/config.php`:

```
'log_exceptions' => true,
'authenticated_user_username_column' => 'email',
```

## to 0.5.0

Expand Down

0 comments on commit df9bef5

Please sign in to comment.