new dashboard and profile pages with new design

This commit is contained in:
Nabeel Shahzad
2017-08-02 13:13:08 -05:00
parent e4dc989ab2
commit e4e23dd8a6
20 changed files with 306 additions and 352 deletions

View File

@@ -6,9 +6,14 @@ use \Illuminate\Support\Facades\Facade;
class Utils extends Facade
{
public static function secondsToTime($seconds) {
public static function secondsToTime($seconds, $incl_sec=false) {
$dtF = new \DateTime('@0');
$dtT = new \DateTime("@$seconds");
return $dtF->diff($dtT)->format('%hh %im %ss');
$format = '%hh %im';
if($incl_sec) {
$format .= ' %ss';
}
return $dtF->diff($dtT)->format($format);
}
}

View File

@@ -25,7 +25,7 @@ class LoginController extends Controller
*
* @var string
*/
protected $redirectTo = '/home';
protected $redirectTo = '/dashboard';
public function showLoginForm()
{

View File

@@ -1,10 +0,0 @@
<?php
namespace App\Http\Controllers\Frontend;
use App\Http\Controllers\AppBaseController;
class BaseController extends AppBaseController
{
}

View File

@@ -2,7 +2,11 @@
namespace App\Http\Controllers\Frontend;
class DashboardController extends BaseController
use Illuminate\Support\Facades\Auth;
use App\Http\Controllers\AppBaseController;
class DashboardController extends AppBaseController
{
/**
* Show the application dashboard.
@@ -11,10 +15,8 @@ class DashboardController extends BaseController
*/
public function index()
{
return $this->view('frontend/dashboard');
}
public function test()
{
return $this->view('frontend/dashboard');
return $this->view('dashboard.index', [
'user' => Auth::user(),
]);
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace App\Http\Controllers\Frontend;
use App\Models\User;
use App\Repositories\AirportRepository;
use App\Http\Controllers\AppBaseController;
use Illuminate\Support\Facades\Auth;
class ProfileController extends AppBaseController
{
private $airportRepository;
public function __construct(AirportRepository $airportRepo)
{
$this->airportRepository = $airportRepo;
}
public function index()
{
$airports = $this->airportRepository->all();
return $this->view('profile.index', [
'user' => Auth::user(),
'airports' => $airports,
]);
}
public function show($id)
{
$user = User::where('id', $id)->first();
if (empty($user)) {
Flash::error('User not found!');
return redirect(route('frontend.dashboard.index'));
}
$airports = $this->airportRepository->all();
return $this->view('profile.index', [
'user' => $user,
'airports' => $airports,
]);
}
public function update()
{
}
}