User profile can be updated by clicking on profile picture
This commit is contained in:
28
app/controllers/DashUserController.php
Normal file
28
app/controllers/DashUserController.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
class DashUserController extends Controller
|
||||
{
|
||||
/**
|
||||
* Shows the user view.
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showUser()
|
||||
{
|
||||
return View::make('dashboard.user')->with([
|
||||
'pageTitle' => 'User - Dashboard',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the statsu page user.
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function postUser()
|
||||
{
|
||||
$items = Input::all();
|
||||
|
||||
$updated = Auth::user()->update($items);
|
||||
|
||||
return Redirect::back()->with('updated', $updated);
|
||||
}
|
||||
}
|
||||
@@ -43,5 +43,6 @@ return [
|
||||
'notifications' => 'Notifications',
|
||||
'toggle_navigation' => 'Toggle Navigation',
|
||||
'search' => 'Search...',
|
||||
'user' => 'User',
|
||||
],
|
||||
];
|
||||
|
||||
@@ -28,4 +28,8 @@ Route::group(['before' => 'auth', 'prefix' => 'dashboard'], function () {
|
||||
// Settings
|
||||
Route::get('settings', ['as' => 'dashboard.settings', 'uses' => 'DashSettingsController@showSettings']);
|
||||
Route::post('settings', 'DashSettingsController@postSettings');
|
||||
|
||||
// User Settings
|
||||
Route::get('user', ['as' => 'dashboard.user', 'uses' => 'DashUserController@showUser']);
|
||||
Route::post('user', 'DashUserController@postUser');
|
||||
});
|
||||
|
||||
39
app/views/dashboard/user.blade.php
Normal file
39
app/views/dashboard/user.blade.php
Normal file
@@ -0,0 +1,39 @@
|
||||
@extends('layout.dashboard')
|
||||
|
||||
@section('content')
|
||||
<div class="header">
|
||||
<i class="fa fa-user"></i> {{ Lang::get('cachet.dashboard.user') }}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@if($updated = Session::get('updated'))
|
||||
<div class='alert alert-{{ $updated ? "success" : "danger" }}'>
|
||||
@if($updated)
|
||||
<strong>Awesome.</strong> Profile updated.
|
||||
@else
|
||||
<strong>Whoops.</strong> Something went wrong when updating.
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form name='UserForm' class='form-vertical' role='form' action='/dashboard/user' method='POST'>
|
||||
<fieldset>
|
||||
<div class='form-group'>
|
||||
<label>Username</label>
|
||||
<input type='text' class='form-control' name='username' value='{{ Auth::user()->username }}' required />
|
||||
</div>
|
||||
<div class='form-group'>
|
||||
<label>Email Address</label>
|
||||
<input type='email' class='form-control' name='email' value='{{ Auth::user()->email }}' required />
|
||||
</div>
|
||||
<div class='form-group'>
|
||||
<label>Password</label>
|
||||
<input type='password' class='form-control' name='password' value='' />
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Update profile</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class='sidebar-inner'>
|
||||
<div class="profile">
|
||||
<div class="avatar pull-left">
|
||||
<a href="{{ URL::to('settings') }}">
|
||||
<a href="{{ URL::to('dashboard/user') }}">
|
||||
<img src="{{ Auth::user()->gravatar }}" alt="">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user