Skip to content

Commit

Permalink
work on userController
Browse files Browse the repository at this point in the history
  • Loading branch information
Halim authored and Halim committed Nov 7, 2016
1 parent d2d762e commit 93f722f
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 4 deletions.
12 changes: 12 additions & 0 deletions app/Http/Controllers/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,5 +168,17 @@ public function edit($id) {
$user = User::findOrFail($id);
return view('users.edit', compact('user'));
}

/*
*
*/
public function reset_password($id) {

$user = User::findOrFail($id);
//dd($user);
return view('users.reset_password', compact('user'));

}


}
2 changes: 1 addition & 1 deletion resources/views/users/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Create New User</div>
<div class="panel-heading">Create New User <a href="{{ url('users') }}" style="float: right;"> Users List</a></div>
<div class="panel-body">

@if($errors->any())
Expand Down
2 changes: 1 addition & 1 deletion resources/views/users/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="panel-heading">Edit User
<a href="{{ url('users') }}" style="float: right;"> Users List</a>
<span style="float: right;margin: 0px 10px;">|</span>
<a href="{{ url('users') }}" style="float: right;">Reset Password </a>
<a href="{{ url("users/$user->users_id/reset_password") }}" style="float: right;">Reset Password </a>
</div>
<div class="panel-body">

Expand Down
67 changes: 67 additions & 0 deletions resources/views/users/reset_password.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
@extends('layouts.app')

@section('content')
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Reset Password for user : <strong>{{ $user->username }}</strong>
<a href="{{ url('users') }}" style="float: right;"> Users List</a>
<span style="float: right;margin: 0px 10px;">|</span>
<a href="{{ url("users/$user->users_id/edit") }}" style="float: right;">Edit User</a>
</div>
<div class="panel-body">

@if($errors->any())
<ul class="alert alert-danger">
@foreach($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
@endif


<form class="form-horizontal" role="form" method="PATCH" action="{{ url('/users', $user->id) }}">

{{ csrf_field() }}

<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<label for="password" class="col-md-4 control-label">New Password</label>

<div class="col-md-6">
<input id="password" type="password" class="form-control" name="password" required>

@if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
</div>
</div>

<div class="form-group">
<label for="password-confirm" class="col-md-4 control-label">Confirm Password</label>

<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>
</div>
</div>


<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
Submit
</button>
</div>
</div>

</form>

</div>
</div>
</div>
</div>
</div>
@endsection

6 changes: 5 additions & 1 deletion resources/views/users/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">User : <strong>{{ $user->username }}</strong> <a href="{{ url("users/$user->id/edit")}}" style="float: right">Edit</a></div>
<div class="panel-heading">User : <strong>{{ $user->username }}</strong>
<a href="{{ url('users') }}" style="float: right;"> Users List</a>
<span style="float: right;margin: 0px 10px;">|</span>
<a href="{{ url("users/$user->users_id/edit")}}" style="float: right">Edit</a>
</div>
<div class="panel-body">

<p>Username : <strong>{{ $user->username }}</strong></p>
Expand Down
4 changes: 3 additions & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,6 @@
Route::post('users', 'UsersController@store');
Route::get('users/{id}/edit', 'UsersController@edit');
Route::patch('users/{id}', 'UsersController@update');
Route::delete('users/{id}', 'UsersController@destroy');
Route::delete('users/{id}', 'UsersController@destroy');

Route::get('users/{id}/reset_password', 'UsersController@reset_password');

0 comments on commit 93f722f

Please sign in to comment.