<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
require_once __DIR__ . '/helpers.php';
Route::get('/', function () {
    return view('welcome');
});
// Supported themes
Route::pattern('theme', 'bootstrap|foundation|materialize');
Route::get('users/{theme?}', function ($theme = 'bootstrap') {
    // Change pagination theme
    Config::set('blade-pagination.theme', $theme);
    // Get CSS framework CDN
    $cdn = get_cdn($theme);
    // Paginate users and render the view
    $users = App\User::paginate(10);
    // Render the view
    return view('users', compact('users', 'theme', 'cdn'));
});
@section('page-title')
<h1 class="auth-user">Welcome, {{ Auth::user()['attributes']['name'] }}<!--
--><a class="link" href="auth/logout">Logout</a></h1>
@stop

@section('content')
@if ( Session::has('flash_message') )

  <div class="alert {{ Session::get('flash_type') }}">
      <h3>{{ Session::get('flash_message') }}</h3>
  </div>

@endif
<nav class="users"><div class="heading">Users</div><a class="link" href="auth/register">Register new user</a></nav>
<?php 
$users = App\User::paginate(9);
$currentUser = Auth::User();
$countPages = $users->lastPage();
$page = Request::Input('page');
if (isset($page) && !empty($page)) {
    $page = Request::Input('page');
} else {
    $page = 1;
}
?>
@if (($page <= $countPages)&&(is_numeric($page)))
<table class="users-table">
<thead>
<tr>
    <th>Username</th>
    <th>Email</th>
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
require_once __DIR__ . '/helpers.php';
Route::get('/', function () {
    return view('welcome');
});
// Out of the box supported themes
Route::pattern('theme', implode('|', Themes::getSupported()));
Route::get('users/{theme?}/{per_page?}', function ($theme = 'bootstrap', $perPage = 10) {
    // Change pagination theme
    Config::set('blade-pagination.theme', $theme);
    // Get CSS framework CDN
    $cdn = Themes::getCdn($theme);
    // Paginate users and render the view
    $users = App\User::paginate($perPage);
    // Render the view
    return view('users', compact('users', 'theme', 'cdn'));
});