Skip to content

Commit

Permalink
Merge branch 'categories-page' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
Ismaeel220 committed Dec 10, 2023
2 parents 37aae7e + ae68296 commit 119306e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 69 deletions.
14 changes: 14 additions & 0 deletions WoodLess/app/Http/Controllers/CategoryController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace App\Http\Controllers;

use App\Models\Category;
use Illuminate\Http\Request;

class CategoryController extends Controller
{
public function getCategories(){
$categories = Category::all();
return view('categories', ['categories' => $categories]);
}
}
4 changes: 2 additions & 2 deletions WoodLess/database/seeders/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public function run(): void
['category' => 'Kitchen','images'=>'/images/Kitchen.png'],
['category' => 'Dining','images'=>'/images/Dining-room.png'],
['category' => 'Bedroom','images'=>'/images/Bedroom.png'],
['category' => 'Bathroom','images'=>'/images/Bathrrom.png'],
['category'=> 'Office','images'=>'/images/Bathroom.png'],
['category' => 'Bathroom','images'=>'/images/Bathroom.png'],
['category'=> 'Office','images'=>'/images/Office.png'],
['category'=> 'Garden','images'=>'/images/Garden.png'],
//etc...
)->create();
Expand Down
74 changes: 7 additions & 67 deletions WoodLess/resources/views/categories.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,84 +23,24 @@
<div class="container">
<div class="container px-4 px-lg-4 mt-2">
<div class="row gx-4 gx-lg-5 row-cols-1 row-cols-md-3 row-cols-xl-3 justify-content-center">
@foreach ($categories as $category)
<div class="col mb-5">
<div class="card category-card h-100">
<!-- Category image-->
<img class="card-img"
src="/images/Kitchen.png"
src="{{ asset($category->images) }}"
height="100%" width="100%" alt="..." />
<!-- Category details-->
<div class="card-img-overlay d-flex flex-column align-items-center">
<!-- Category actions-->
<a class="btn mt-auto stretched-link shadow border border-info" href="#">Kitchen
Category</a>
<a class="btn mt-auto stretched-link shadow border border-info" href="">{{ $category->category }}
</a>
</div>
</div>
</div>
<div class="col mb-5">
<div class="card category-card h-100">
<!-- Category image-->
<img class="card-img"
src="/images/Dining-room.png"
height="100%" width="100%" alt="..." />
<!-- Category details-->
<div class="card-img-overlay d-flex flex-column align-items-center">
<!-- Category actions-->
<a class="btn mt-auto stretched-link shadow border border-info" href="#">Dining Room</a>
</div>
</div>
</div>
<div class="col mb-5">
<div class="card category-card h-100">
<!-- Category image-->
<img class="card-img"
src="/images/Bedroom.png"
height="100%" width="100%" alt="..." />
<!-- Category details-->
<div class="card-img-overlay d-flex flex-column align-items-center">
<!-- Category actions-->
<a class="btn mt-auto stretched-link shadow border border-info" href="#">Bedroom</a>
</div>
</div>
</div>
<div class="col mb-5">
<div class="card category-card h-100">
<!-- Category image-->
<img class="card-img"
src="/images/Bathroom.png"
height="100%" width="100%" alt="..." />
<!-- Category details-->
<div class="card-img-overlay d-flex flex-column align-items-center">
<!-- Category actions-->
<a class="btn mt-auto stretched-link shadow border border-info" href="#">Bathroom</a>
</div>
</div>
</div>
<div class="col mb-5">
<div class="card category-card h-100">
<!-- Category image-->
<img class="card-img"
src="/images/Office.png"
height="100%" width="100%" alt="..." />
<!-- Category details-->
<div class="card-img-overlay d-flex flex-column align-items-center">
<!-- Category actions-->
<a class="btn mt-auto stretched-link shadow border border-info" href="#">Office</a>
</div>
</div>
</div>
<div class="col mb-5">
<div class="card category-card h-100">
<!-- Category image-->
<img class="card-img"
src="/images/Garden.png"
height="100%" width="100%" alt="..." />
<!-- Category details-->
<div class="card-img-overlay d-flex flex-column align-items-center">
<!-- Category actions-->
<a class="btn mt-auto stretched-link shadow border border-info" href="#">Garden</a>
</div>
</div>
@endforeach


</div>
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions WoodLess/routes/web.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?php

<<<<<<< HEAD
use Illuminate\Http\Request;
=======
use App\Http\Controllers\CategoryController;
>>>>>>> categories-page
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\BasketController;
Expand Down Expand Up @@ -58,6 +62,7 @@
Route::view('/admin-panel', 'admin-panel');

Auth::routes();
Route::get('/categories', [CategoryController::class, 'getCategories']);

Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');

Expand Down

0 comments on commit 119306e

Please sign in to comment.