fix moment star
This commit is contained in:
parent
7f5703e2ef
commit
bf02e9b43d
3 changed files with 12 additions and 19 deletions
|
|
@ -502,17 +502,10 @@ class ProductsController extends Controller
|
|||
return $order->order + 1;
|
||||
}
|
||||
|
||||
public function changeStar($id)
|
||||
public function changeStar(Products $product)
|
||||
{
|
||||
$p = Products::findOrFail($id);
|
||||
|
||||
if ($p->star === 0) {
|
||||
$p->star = 1;
|
||||
} else {
|
||||
$p->star = 0;
|
||||
}
|
||||
|
||||
$p->save();
|
||||
return redirect()->route('bo.products.index');
|
||||
$product->star = !$product->star;
|
||||
$product->saveOrFail();
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,19 +34,19 @@
|
|||
<th>{{$product->name}}</th>
|
||||
<td>{{$product->range->name}}</td>
|
||||
<td>
|
||||
<a href="{{route('bo.products.change-star', $product->id)}}" class="btn-link">
|
||||
@if ($product->star === 0)
|
||||
<i name="star_empty" class="icon-size far fa-star not-star-hover"></i>
|
||||
<a href="{{route('bo.products.change-star', $product)}}" class="btn-link">
|
||||
@if ($product->star)
|
||||
<i name="star_full" class="icon-size fas fa-star star-hover"></i>
|
||||
@else
|
||||
<i name="star_full" class="icon-size fas fa-star star-hover"></i>
|
||||
<i name="star_empty" class="icon-size far fa-star not-star-hover"></i>
|
||||
@endif
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
@if ($product->status === 0)
|
||||
<i class="fas fa-times cross-red"></i>
|
||||
@if ($product->status)
|
||||
<i class="fas fa-check check-green"></i>
|
||||
@else
|
||||
<i class="fas fa-check check-green"></i>
|
||||
<i class="fas fa-times cross-red"></i>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ Route::prefix('bo')
|
|||
Route::get('/ocb/content/{type}', [OCBContentController::class, 'index'])->name('ocb.content');
|
||||
Route::get('/product-slider-pictures/change-order/{id}/{action}', [ProductSliderPicturesController::class, 'changeOrder'])->name('product-slider-pictures.change-order');
|
||||
Route::get('/products/change-order/{id}/{action}', [BoProductsController::class, 'changeOrder'])->name('products.change-order');
|
||||
Route::get('/products/change-star/{id}', [BoProductsController::class, 'changeStar'])->name('products.change-star');
|
||||
Route::get('/products/change-star/{product}', [BoProductsController::class, 'changeStar'])->name('products.change-star');
|
||||
Route::get('/ranges/change-order/{id}/{action}', [RangesController::class, 'changeOrder'])->name('ranges.change-order');
|
||||
Route::get('/recipes/highlights/choice', [BoRecipesController::class, 'highlights'])->name('recipes.highlights');
|
||||
Route::get('/reductions', [ReductionsController::class, 'index'])->name('reductions.index');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue