Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/dhee-tree/Team-19 in…
Browse files Browse the repository at this point in the history
…to development
  • Loading branch information
Ismaeel220 committed Dec 10, 2023
2 parents 2bd428b + 86c49c3 commit 5fcfaf3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion WoodLess/app/Http/Controllers/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function show(Product $product)
request('order') ?? 'desc'
)->paginate(5)->withQueryString()->fragment('reviews');

return view('product-display', [
return view('products.show', [
'product' => $product,
//'attributes' => ["5" => 2, "3" => 2] (???),
'attributes' => json_decode($product->attributes, true),
Expand Down
5 changes: 5 additions & 0 deletions WoodLess/app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,9 @@ public function basket()
{
return $this->hasOne(Basket::class);
}


public function isAdmin(){
return $this->makeVisible('is_admin')->is_admin;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function up(): void
$table->string('password', 255);
$table->string('phone_number', 15);
$table->string('image', 255)->default('no-image.svg');
$table->boolean('is_admin')->default(false)->invisible();
$table->boolean('is_admin')->default(false);
$table->rememberToken();
$table->timestamp('email_verified_at')->nullable();
$table->timestamps();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<div class="d-flex flex-row">
<div class="" id="product-categories">
@foreach ($categories as $category)
<a class="category-button btn btn-dark px-1 py-0" role="button" href="/categories/{{lcfirst($category->category)}}">{{$category->category}}</a>
<a class="category-button btn btn-dark px-1 py-0" role="button" href="/products?categories%5B%5D={{ucfirst($category->category)}}">{{$category->category}}</a>
@endforeach
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion WoodLess/resources/views/reviews/load.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
</small></p>
</div>
@auth
@if ($user == auth()->user() || auth()->user()->is_admin)
@if ($user == auth()->user() || auth()->user()->isAdmin())
<div class="">
<form method="POST" action="/review/{{$review->id}}">
@csrf
Expand All @@ -174,6 +174,7 @@
</div>
</div>
@endforeach
@if ($reviews->hasPages())
<div class="col" id="pageSelector">
<nav aria-label="...">
<ul class="pagination">
Expand All @@ -186,4 +187,5 @@
</ul>
</nav>
</div>
@endif
</div>

0 comments on commit 5fcfaf3

Please sign in to comment.