Skip to content

Commit ebbac68

Browse files
committed
review products functionality
1 parent 9772117 commit ebbac68

23 files changed

+164
-339
lines changed

EasyShop/app/Http/Controllers/CartController.php

+17-17
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,23 @@ public function destroy($id){
3636
public function update(Request $request, $id)
3737
{
3838
$qty = $request->qty;
39-
$proId = $request->proId;
40-
$rowId = $request->rowId;
41-
Cart::update($rowId,$qty); // for update
42-
$cartItems = Cart::content(); // display all new data of cart
43-
return view('cart.upCart', compact('cartItems'))->with('status', 'cart updated');
44-
/* $products = products::find($proId);
45-
$stock = $products->stock;
46-
if($qty<$stock){
47-
$msg = 'Cart is updated';
48-
Cart::update($id,$request->qty);
49-
return back()->with('status',$msg);
50-
}else{
51-
$msg = 'Please check your qty is more than product stock';
52-
return back()->with('error',$msg);
53-
} */
54-
55-
}
39+
$proId = $request->proId;
40+
$rowId = $request->rowId;
41+
Cart::update($rowId,$qty); // for update
42+
$cartItems = Cart::content(); // display all new data of cart
43+
return view('cart.upCart', compact('cartItems'))->with('status', 'cart updated');
44+
/* $products = products::find($proId);
45+
$stock = $products->stock;
46+
if($qty<$stock){
47+
$msg = 'Cart is updated';
48+
Cart::update($id,$request->qty);
49+
return back()->with('status',$msg);
50+
}else{
51+
$msg = 'Please check your qty is more than product stock';
52+
return back()->with('error',$msg);
53+
} */
54+
55+
}
5656

5757

5858
}

EasyShop/app/Http/Controllers/HomeController.php

+8-5
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,14 @@ public function selectColor(Request $colorRequest){
188188

189189
}
190190

191-
192-
193-
194-
195-
191+
public function addReview(Request $request){
192+
DB::table('reviews')->insert(
193+
['person_name' => $request->person_name, 'person_email' => $request->person_email,
194+
'review_content' => $request->review_content,
195+
'created_at' => date("Y-m-d H:i:s"),'updated_at' =>date("Y-m-d H:i:s")]
196+
);
197+
return back();
198+
}
196199

197200

198201

EasyShop/resources/public/favicon.ico

Whitespace-only changes.
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
16.7 KB
Loading
19.3 KB
Loading
17.6 KB
Loading

EasyShop/resources/public/index.php

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
3+
/**
4+
* Laravel - A PHP Framework For Web Artisans
5+
*
6+
* @package Laravel
7+
* @author Taylor Otwell <taylor@laravel.com>
8+
*/
9+
10+
/*
11+
|--------------------------------------------------------------------------
12+
| Register The Auto Loader
13+
|--------------------------------------------------------------------------
14+
|
15+
| Composer provides a convenient, automatically generated class loader for
16+
| our application. We just need to utilize it! We'll simply require it
17+
| into the script here so that we don't have to worry about manual
18+
| loading any of our classes later on. It feels nice to relax.
19+
|
20+
*/
21+
22+
require __DIR__.'/../bootstrap/autoload.php';
23+
24+
/*
25+
|--------------------------------------------------------------------------
26+
| Turn On The Lights
27+
|--------------------------------------------------------------------------
28+
|
29+
| We need to illuminate PHP development, so let us turn on the lights.
30+
| This bootstraps the framework and gets it ready for use, then it
31+
| will load up this application so that we can run it and send
32+
| the responses back to the browser and delight our users.
33+
|
34+
*/
35+
36+
$app = require_once __DIR__.'/../bootstrap/app.php';
37+
// set the public path to this directory
38+
39+
/*
40+
|--------------------------------------------------------------------------
41+
| Run The Application
42+
|--------------------------------------------------------------------------
43+
|
44+
| Once we have the application, we can handle the incoming request
45+
| through the kernel, and send the associated response back to
46+
| the client's browser allowing them to enjoy the creative
47+
| and wonderful application we have prepared for them.
48+
|
49+
*/
50+
51+
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
52+
53+
$response = $kernel->handle(
54+
$request = Illuminate\Http\Request::capture()
55+
);
56+
57+
$response->send();
58+
59+
$kernel->terminate($request, $response);

EasyShop/resources/public/robots.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
User-agent: *
2+
Disallow:

EasyShop/resources/public/web.config

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<configuration>
2+
<system.webServer>
3+
<rewrite>
4+
<rules>
5+
<rule name="Imported Rule 1" stopProcessing="true">
6+
<match url="^(.*)/$" ignoreCase="false" />
7+
<conditions>
8+
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
9+
</conditions>
10+
<action type="Redirect" redirectType="Permanent" url="/{R:1}" />
11+
</rule>
12+
<rule name="Imported Rule 2" stopProcessing="true">
13+
<match url="^" ignoreCase="false" />
14+
<conditions>
15+
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
16+
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
17+
</conditions>
18+
<action type="Rewrite" url="index.php" />
19+
</rule>
20+
</rules>
21+
</rewrite>
22+
</system.webServer>
23+
</configuration>

EasyShop/resources/views/admin/products.blade.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<th>Product Name</th>
5151
<th>Product Code</th>
5252
<th>Product Price</th>
53-
<th>Alt Images</th>
53+
<th>Alt Images</th>
5454
<th>On Sale</th>
5555
<th>update</th>
5656
</tr>
@@ -67,7 +67,14 @@
6767
<td>{{$product->pro_name}}</td>
6868
<td>{{$product->pro_code}}</td>
6969
<td>{{$product->pro_price}}</td>
70-
<td><a href="{{url('/')}}/admin/addAlt/{{$product->id}}"
70+
<td>
71+
<?php
72+
$Aimgs = DB::table('alt_images')->where('proId', $product->id)
73+
->get();
74+
75+
?>
76+
<p> {{count($Aimgs)}} images found</p>
77+
<a href="{{url('/')}}/admin/addAlt/{{$product->id}}"
7178
class="btn btn-info" style="border-radius:20px;">
7279
<i class="fa fa-plus"></i> Add</a></td>
7380

EasyShop/resources/views/front/menu.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
*
4141
*/ ?>
4242
<li><a href="{{url('/contact')}}">Contact</a></li>
43-
<li><a href="{{url('/newArrival')}}" style="background:red; color:#fff">New Arrival</a></li>
43+
<li><a href="{{url('/newArrival')}}">New Arrival</a></li>
4444
</ul>
4545
</div>
4646
</div>

0 commit comments

Comments
 (0)