Skip to content

Commit ab03d1b

Browse files
committed
part 43 and 44 of tutorials updation
product images in cart, alert messages, Custom 404 error page
1 parent ad72151 commit ab03d1b

File tree

6 files changed

+102
-29
lines changed

6 files changed

+102
-29
lines changed

EasyShop/app/Http/Controllers/CartController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function index(){
1515
public function addItem($id){
1616
$products = products::find($id); // get prodcut by id
1717

18-
Cart::add($id,$products->pro_name, 1, $products->pro_price);
18+
Cart::add($id,$products->pro_name, 1, $products->pro_price, ['img' => $products->pro_img]);
1919
return back();
2020
}
2121

EasyShop/app/Http/Controllers/ProfileController.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function updateAddress(Request $request) {
3737
$userid = Auth::user()->id;
3838
DB::table('address')->where('user_id', $userid)->update($request->except('_token'));
3939

40-
return back();
40+
return back()->with('msg','Your address has been upodated');
4141
}
4242

4343
public function Password() {
@@ -50,11 +50,11 @@ public function updatePassword(Request $request) {
5050

5151

5252
if(!Hash::check($oldPassword, Auth::user()->password)){
53-
echo 'The specified password does not match the database password'; //when user enter wrong password as current password
53+
return back()->with('msg','The specified password does not match the database password'); //when user enter wrong password as current password
5454

5555
}else{
5656
$request->user()->fill(['password' => Hash::make($newPassword)])->save(); //updating password into user table
57-
echo 'done';
57+
return back()->with('msg','Password has been updated');
5858
}
5959
// echo 'here update query for password';
6060
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
@extends('front.master')
2+
3+
<div class="container">
4+
<div class="row">
5+
<div class="span12">
6+
<div class="hero-unit center">
7+
<h1>Page Not Found <small><font face="Tahoma" color="red">Error 404</font></small></h1>
8+
<br />
9+
<p>The page you requested could not be found, either contact your webmaster or try again. Use your browsers <b>Back</b> button to navigate to the page you have prevously come from</p>
10+
<p><b>Or you could just press this neat little button:</b></p>
11+
<a href="#" class="btn btn-large btn-info"><i class="icon-home icon-white"></i> Take Me Home</a>
12+
</div>
13+
<br />
14+
<div class="thumbnail">
15+
<center><h2>Recent Content :</h2></center>
16+
</div>
17+
<br />
18+
<div class="thumbnail span3 center">
19+
<h3>Try This...</h3>
20+
<p>write about your error page conent here and give some fool a good load of information or not</p>
21+
<div class="hero-unit">
22+
<img src="http://placehold.it/100x100"><!--Why Not Put a Picture To Celebrate Your 404-->
23+
<p></p>
24+
</div>
25+
<a href="#" class="btn btn-danger btn-large"><i class="icon-share icon-white"></i> Take Me There...</a>
26+
</div>
27+
<div class="thumbnail span3 center">
28+
<h3>Try This...</h3>
29+
<p>write about your error page conent here and give some fool a good load of information or not</p>
30+
<div class="hero-unit">
31+
<img src="http://placehold.it/100x100"><!--Why Not Put a Picture To Celebrate Your 404-->
32+
<p></p>
33+
</div>
34+
<a href="#" class="btn btn-danger btn-large"><i class="icon-share icon-white"></i> Take Me There...</a>
35+
</div>
36+
<div class="thumbnail span3 center">
37+
<h3>Try This...</h3>
38+
<p>write about your error page conent here and give some fool a good load of information or not</p>
39+
<div class="hero-unit">
40+
<img src="http://placehold.it/100x100"><!--Why Not Put a Picture To Celebrate Your 404-->
41+
<p></p>
42+
</div>
43+
<a href="#" class="btn btn-danger btn-large"><i class="icon-share icon-white"></i> Take Me There...</a>
44+
</div>
45+
<div class="thumbnail span3 center">
46+
<h3>Try This...</h3>
47+
<p>write about your error page conent here and give some fool a good load of information or not</p>
48+
<div class="hero-unit">
49+
<img src="http://placehold.it/100x100"><!--Why Not Put a Picture To Celebrate Your 404-->
50+
<p></p>
51+
</div>
52+
<a href="#" class="btn btn-danger btn-large"><i class="icon-share icon-white"></i> Take Me There...</a>
53+
</div>
54+
<br />
55+
<p></p>
56+
<!-- By ConnerT HTML & CSS Enthusiast -->
57+
</div>
58+
</div>
59+
</div>

EasyShop/resources/views/profile/address.blade.php

+17-7
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,25 @@
1818

1919

2020

21+
2122
<div class="row">
23+
2224
@include('profile.menu')
2325
<div class="col-md-8">
2426

27+
@if(session('msg'))
28+
<div class="alert alert-info">
29+
<a href='#' class="close" data-dismiss="alert" aria-label="close">x</a>
30+
{{session('msg')}}
31+
32+
</div>
33+
@endif
34+
2535
<h3><span style='color:green'>{{ucwords(Auth::user()->name)}}</span>, Your Address</h3>
2636

2737
{!! Form::open(['url' => 'updateAddress', 'method' => 'post']) !!}
2838

29-
@foreach($address_data as $value)
39+
@foreach($address_data as $value)
3040
<div class="container" >
3141

3242

@@ -35,39 +45,39 @@
3545
<div class="form-group col-md-6">
3646
<label for="example-text-input" >Full Name</label>
3747
<input class="form-control" type="text" name="fullname" value="{{$value->fullname}}">
38-
<span style="color:red">{{ $errors->first('fullname') }}</span>
48+
<span style="color:red">{{ $errors->first('fullname') }}</span>
3949
</div>
4050
</div>
4151
<div class="form-group row">
4252

4353
<div class="form-group col-md-6">
4454
<label for="example-text-input">City</label>
4555
<input class="form-control" type="text" name="city" value="{{$value->city}}">
46-
<span style="color:red">{{ $errors->first('city') }}</span>
56+
<span style="color:red">{{ $errors->first('city') }}</span>
4757
</div>
4858
</div>
4959
<div class="form-group row">
5060

5161
<div class="form-group col-md-6">
5262
<label for="example-text-input" >State</label>
5363
<input class="form-control" type="text" name="state" value="{{$value->state}}">
54-
<span style="color:red">{{ $errors->first('state') }}</span>
64+
<span style="color:red">{{ $errors->first('state') }}</span>
5565
</div>
5666
</div>
5767
<div class="form-group row">
5868

5969
<div class="form-group col-md-6">
6070
<label for="example-text-input" >Pincode</label>
6171
<input class="form-control" type="text" name="pincode" value="{{$value->pincode}}">
62-
<span style="color:red">{{ $errors->first('pincode') }}</span>
72+
<span style="color:red">{{ $errors->first('pincode') }}</span>
6373
</div>
6474
</div>
6575
<div class="form-group row">
6676

6777
<div class="form-group col-md-6">
6878
<label for="example-text-input" >Country</label>
6979
<input class="form-control" type="text" name="country" value="{{$value->country}}">
70-
<span style="color:red">{{ $errors->first('country') }}</span>
80+
<span style="color:red">{{ $errors->first('country') }}</span>
7181
</div>
7282
</div>
7383
<div class="form-group row">
@@ -79,7 +89,7 @@
7989

8090

8191
</div>
82-
@endforeach
92+
@endforeach
8393
{!! Form::close() !!}
8494
</div>
8595
</div>

EasyShop/resources/views/profile/updatePassword.blade.php

+20-16
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
@include('profile.menu')
2323
<div class="col-md-8">
2424

25+
@if(session('msg'))
26+
<div class="alert alert-info"> {{session('msg')}}</div>
27+
@endif
28+
2529
<h3><span style='color:green'>{{ucwords(Auth::user()->name)}}</span>, Update your Password</h3>
2630

2731
{!! Form::open(['url' => 'updatePassword', 'method' => 'post']) !!}
@@ -35,26 +39,26 @@
3539
<div class="form-group col-md-5">
3640
<label for="example-text-input">Current Password</label>
3741
<input class="form-control" type="password" name="oldPassword">
38-
<span style="color:red">{{ $errors->first('old_password') }}</span>
39-
40-
<br>
41-
42-
<label for="example-text-input" >New Password</label>
43-
<input class="form-control" type="password" name="newPassword">
44-
<span style="color:red">{{ $errors->first('newPassword') }}</span>
45-
46-
<br>
47-
<div align="right"> <input type="submit" value="Update Password" class="btn btn-primary"></div>
42+
<span style="color:red">{{ $errors->first('old_password') }}</span>
43+
44+
<br>
45+
46+
<label for="example-text-input" >New Password</label>
47+
<input class="form-control" type="password" name="newPassword">
48+
<span style="color:red">{{ $errors->first('newPassword') }}</span>
49+
50+
<br>
51+
<div align="right"> <input type="submit" value="Update Password" class="btn btn-primary"></div>
4852
</div>
49-
50-
51-
52-
53+
54+
55+
56+
5357
</div>
5458

5559
</div>
56-
57-
{!! Form::close() !!}
60+
61+
{!! Form::close() !!}
5862
</div>
5963
</div>
6064
</div>

EasyShop/routes/web.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
Route::get('/orders', 'ProfileController@orders');
4141

4242
Route::get('/address', 'ProfileController@address');
43-
Route::post('/updateAddress', 'ProfileController@UpdateAddress');
44-
43+
Route::post('/updateAddress', 'ProfileController@UpdateAddress');
44+
4545
Route::get('/password', 'ProfileController@Password');
4646
Route::post('/updatePassword', 'ProfileController@updatePassword');
4747

0 commit comments

Comments
 (0)