-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,5 +21,7 @@ MAIL_ENCRYPTION=null | |
MAIL_FROM=[email protected] | ||
MAIL_FROM_NAME=Project Administrator | ||
|
||
ADMIN_EMAIL=[email protected] | ||
|
||
GOOGLE_UA= | ||
USERVOICE_URL= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,26 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
use Illuminate\Support\Facades\Auth; | ||
|
||
use App\User; | ||
use Illuminate\Support\Facades\Redirect; | ||
use Illuminate\Support\Facades\View; | ||
|
||
class AdminController extends BaseController { | ||
|
||
/** | ||
* Takes you to the admin page of the app | ||
* @return mixed | ||
*/ | ||
public function index(){ | ||
if( Auth::user()->email != env('ADMIN_EMAIL') ){ | ||
return Redirect::back(); | ||
} | ||
|
||
$users = User::all(); | ||
$n = count($users); | ||
return View::make('admin/index')->with('pTitle', 'Admin')->with('users', $users)->with('n', $n); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,3 +67,4 @@ | |
}); | ||
|
||
//----------------- Admin routes | ||
Route::get('admin','AdminController@index'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
@extends('templates/ins/master') | ||
|
||
@section('content') | ||
|
||
<div class="row"> | ||
<div class="col-xs-12"> | ||
<h1>Admin</h1> | ||
<p>Number of users: <span class="badge">{{ $n }}</span></p> | ||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th>Full Name</th> | ||
<th>Email</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
@foreach ($users as $user) | ||
<tr> | ||
<td>{{ $user->full_name }}</td> | ||
<td>{{ $user->email }}</td> | ||
</tr> | ||
@endforeach | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
|
||
@stop() |