- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
38. Laravel 13 E-Commerce Project - Add Product To Wishlist
Welcome back to the Laravel E-Commerce Tutorial! In this video, we'll cover how to add an "Add Product to Wishlist" feature to our online store.
We will start by generating a new `WishlistController` using the command prompt. Inside this controller, you will learn how to write the `add_to_wishlist` function by utilizing our existing Cart package, but assigning it to a separate `'wishlist'` instance to keep it distinct from the main shopping cart. We will then set up the corresponding POST route in our `web.php` file.
Next, we will head to the frontend and update our `shop.blade.php` view. You will learn how to write PHP logic at the top of the file to check if a product already exists in the wishlist session cache (`$isInWishlist`) and determine its final price. We will replace the static heart button with a secure HTML form using hidden input fields to pass the product data. We will also use Blade `@if` conditionals to dynamically change the heart icon from a regular outline to a filled red color if the item is already wishlisted. We will apply this same dynamic form to the individual product details page, and finally, update our main layout header to display a global wishlist item counter!
If you found this video helpful, please subscribe and hit the bell icon to stay updated on the next parts of this series. Thanks for watching, and I’ll see you in the next video!
Topics Discussed in this Video:
1. Creating a `WishlistController` using the `php artisan make:controller` command.
2. Writing the `add_to_wishlist` function using `Cart::instance('wishlist')` to separate wishlist items from the main cart.
3. Creating the `/wishlist/add` POST route in the `web.php` file.
4. Using the `contains()` method in Blade to check if a product ID already exists in the wishlist instance.
5. Creating an HTML form with hidden inputs to securely pass the product ID, name, quantity, and price.
6. Dynamically toggling between a solid red FontAwesome heart (`fa-solid text-red-500`) and an empty heart outline based on the item's wishlist status.
7. Integrating the same add-to-wishlist form into the `details.blade.php` product details view.
8. Updating the global `app.blade.php` layout header to display the current wishlist item count using the `count()` method.
9. Testing the wishlist functionality from both the shop page and the product details page in the browser.
Your Queries:
1. How to create an "Add to Wishlist" feature in a Laravel 13 e-commerce project?
2. How to use multiple instances of a shopping cart package (like a separate wishlist instance) in Laravel?
3. How to check if a specific item already exists in a session cache or cart instance?
4. How to pass hidden data in a Laravel Blade form?
5. How to dynamically change a FontAwesome heart icon using Blade `@if` conditionals?
6. How to display a dynamic wishlist counter badge in a Laravel layout file?
Template Url :
https://github.com/surfsidemedia/Laravel-13-E-Commerce-Project-Template
Project Source Code:
https://www.surfsidemedia.in/categories/laravel-13-e-commerce-project
FOLLOW SURFSIDE MEDIA:
https://www.facebook.com/SurfsideM/
https://twitter.com/MediaSurfside
https://github.com/surfsidemedia
https://surfsidemedia.tumblr.com/
#laravel #laravel13 #laravel13x
Видео 38. Laravel 13 E-Commerce Project - Add Product To Wishlist канала Surfside Media
We will start by generating a new `WishlistController` using the command prompt. Inside this controller, you will learn how to write the `add_to_wishlist` function by utilizing our existing Cart package, but assigning it to a separate `'wishlist'` instance to keep it distinct from the main shopping cart. We will then set up the corresponding POST route in our `web.php` file.
Next, we will head to the frontend and update our `shop.blade.php` view. You will learn how to write PHP logic at the top of the file to check if a product already exists in the wishlist session cache (`$isInWishlist`) and determine its final price. We will replace the static heart button with a secure HTML form using hidden input fields to pass the product data. We will also use Blade `@if` conditionals to dynamically change the heart icon from a regular outline to a filled red color if the item is already wishlisted. We will apply this same dynamic form to the individual product details page, and finally, update our main layout header to display a global wishlist item counter!
If you found this video helpful, please subscribe and hit the bell icon to stay updated on the next parts of this series. Thanks for watching, and I’ll see you in the next video!
Topics Discussed in this Video:
1. Creating a `WishlistController` using the `php artisan make:controller` command.
2. Writing the `add_to_wishlist` function using `Cart::instance('wishlist')` to separate wishlist items from the main cart.
3. Creating the `/wishlist/add` POST route in the `web.php` file.
4. Using the `contains()` method in Blade to check if a product ID already exists in the wishlist instance.
5. Creating an HTML form with hidden inputs to securely pass the product ID, name, quantity, and price.
6. Dynamically toggling between a solid red FontAwesome heart (`fa-solid text-red-500`) and an empty heart outline based on the item's wishlist status.
7. Integrating the same add-to-wishlist form into the `details.blade.php` product details view.
8. Updating the global `app.blade.php` layout header to display the current wishlist item count using the `count()` method.
9. Testing the wishlist functionality from both the shop page and the product details page in the browser.
Your Queries:
1. How to create an "Add to Wishlist" feature in a Laravel 13 e-commerce project?
2. How to use multiple instances of a shopping cart package (like a separate wishlist instance) in Laravel?
3. How to check if a specific item already exists in a session cache or cart instance?
4. How to pass hidden data in a Laravel Blade form?
5. How to dynamically change a FontAwesome heart icon using Blade `@if` conditionals?
6. How to display a dynamic wishlist counter badge in a Laravel layout file?
Template Url :
https://github.com/surfsidemedia/Laravel-13-E-Commerce-Project-Template
Project Source Code:
https://www.surfsidemedia.in/categories/laravel-13-e-commerce-project
FOLLOW SURFSIDE MEDIA:
https://www.facebook.com/SurfsideM/
https://twitter.com/MediaSurfside
https://github.com/surfsidemedia
https://surfsidemedia.tumblr.com/
#laravel #laravel13 #laravel13x
Видео 38. Laravel 13 E-Commerce Project - Add Product To Wishlist канала Surfside Media
How to Program laravel (Software) laravel laravel v13 laravel 13 laravel project laravel setting up laravel v13 setting up laravel v13.0 v13.0 laravel 13.0 laravel 13 playlist laravel 13 tutorial laravel tutorial laravel 13.0 tutorial for beginners laravel for beginners laravel tutorial for beginners laravel13 laravel 13 ecommerce tutorial laravel 13 ecommerce ecommerce project in laravel 13 laravel 13 ecommerce project surfside media add to wishlist
Комментарии отсутствуют
Информация о видео
22 ч. 52 мин. назад
00:08:17
Другие видео канала





















